Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>Experiments with Sass Color Functions</h1>

<p>Top and bottom border to all divs are generated with <code>grayscale($color)</code> and <code>desaturate($color, 20)</code>, respectively.</p>

<h2>Sass Native:</h2>

<div class="darken">
  <pre>darken($color, 20);</pre>
  <p>Darken base color by 20%.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#darken-instance_method">Documentation.</a> Related: <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#lighten-instance_method">lighten</a></p>
</div>

<div class="complement">
  <pre>complement($color);</pre>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#complement-instance_method">Documentation.</a></p>
</div>

<div class="saturate">
  <pre>saturate($color, 20);</pre>
  <p>Increase saturation of base color by 20%.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#saturate-instance_method">Documentation</a>. Related: <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#desaturate-instance_method">desaturate</a></p>
</div>

<div class="invert">
  <pre>invert($color);</pre>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#invert-instance_method">Documentation.</a></p>
</div>

<div class="mix">
  <pre>mix($color, #00F, 75%);</pre>
  <p>Mix blue into the base color by 75%.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method">Documentation.</a></p>
</div>

<div class="hue">
  <pre>adjust_hue($color, 110);</pre>
  <p>Rotate base color by 110 degrees around the color wheel.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#adjust_hue-instance_method">Documentation</a></p>
</div>

<div class="adjust-single">
  <pre>adjust-color($color, $green: 128);</pre>
  <p>Add a hue to a color, by value. Use a negative number to subtract a color.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#adjust_color-instance_method">Documentation.</a> Related: <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#scale_color-instance_method">scale-color</a>, <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#change_color-instance_method">change-color</a></p>
</div>

<div class="adjust-multiple">
  <pre>adjust-color($color, $green: -64, $blue: -64)</pre>
  <p>Remove multiple hues from a color, by value. Use a positve number to add a hue.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#adjust_color-instance_method">Documentation.</a></p>
</div>

<div class="transparentize">
  <pre>transparentize(gray, .5);</pre>
  <p>Adjust the transparency (alpha) of a color.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#transparentize-instance_method">Documentation.</a> Related: <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#fade_out-instance_method">fade-out</a>, <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#opacify-instance_method">opacify</a>, <a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#transparentize-instance_method">transparentize</a></p>
</div>

<div class="red">
  <pre>rgb(red($color), 0, 0)</pre>
  <p>Use only the amount of red in the base color.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#red-instance_method">Documentation.</a></p>
</div>

<div class="green">
  <pre>rgb(0, green($color), 0);</pre>
  <p>Use only the amount of green in the base color.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#green-instance_method">Documentation.</a></p>
</div>

<div class="blue">
  <pre>rgb(0, 0, blue($color));</pre>
  <p>Use only the amount of blue in the base color.</p>
  <p class="docs"><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#blue-instance_method">Documentation.</a></p>
</div>

<p>Also see color "getter" functions:</p>
<ul>
  <li><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#hue-instance_method">hue($color)</a></li>
  <li><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#saturation-instance_method">saturation($color)</a></li>
  <li><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#lightness-instance_method">lightness($color)</a></li>
  <li><a href="http://sass-lang.com/documentation/Sass/Script/Functions.html#alpha-instance_method">alpha($color)</a></li>
</ul>

<h2>Compass:</h2>

<div class="shade">
  <pre>shade($color, 50%);</pre>
  <p>Mix <code>$color</code> with black, by %.</p>
  <p class="docs"><a href="http://compass-style.org/reference/compass/helpers/colors/#shade">Documentation.</a> Related:  <a href="http://compass-style.org/reference/compass/helpers/colors/#tint">tint</a></p>
</div>
              
            
!

CSS

              
                @import "compass/css3";

$color: #C6538C;  // Sass Pink

/* Other interesting / enlightening color values
$color: #C6538C;  // Sass Pink
$color: #bada55;
$color: #cab1e5;
$color: #c0ffee;
$color: blueviolet;
$color: goldenrod;
$color: darkturquoise;
*/

body {
  background-color: $color;
}

.darken {
  background-color: darken($color, 20);
}

.complement {
  background-color: complement($color);
}

.saturate {
  background-color: saturate($color, 20);
}

.invert {
  background-color: invert($color);
}

.mix {
  background-color: mix($color, #00F, 75%);
}

.hue {
  background-color: adjust_hue($color, 110);
}

.adjust-single {
  background-color: adjust-color($color, $green: 128);
}

.adjust-multiple {
  background-color: adjust-color($color, $green: -64, $blue: -64);
}

.transparentize {
  background-color: transparentize(gray, .5);
}

.red {
  background-color: rgb(red($color), 0, 0);
}

.green {
  background-color: rgb(0, green($color), 0);
}

.blue {
  background-color: rgb(0, 0, blue($color));
}

.shade {
  background-color: shade($color, 50%);
}

div {
  color: white;
  border-top: solid grayscale($color) 5px;
  border-bottom: solid desaturate($color, 20) 5px;
  font-weight: bold;
  width: 46%;
  padding: 1%;
  margin: 1%;
  float: left;

  &:nth-child(2n) { clear:left; }
  
  pre { font-size: large; margin: .5rem; }
  
  p { margin: .5rem;
    &.docs {font-weight: normal;}
  }
  
}

p { clear: both; }
              
            
!

JS

              
                
              
            
!
999px

Console