cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="swatch"><pre>base</pre></div>

<div class="swatch darken"><pre>darken</pre></div>

<div class="swatch lighten"><pre>lighten</pre></div>

<div class="swatch saturate"><pre>saturate</pre></div>

<div class="swatch desaturate"><pre>desaturate</pre></div>

<div class="swatch adjust-hue"><pre>adjust-hue</pre></div>

<div class="swatch adjust-opacity"><pre>opacity</pre></div>

<div class="swatch adjust-tint"><pre>tint</pre></div>

<div class="swatch adjust-shade"><pre>shade</pre></div>
            
          
!
            
              @import "bourbon";

// set your primary color only, but feel free to adjust the other color percentages
$base-color:       #6699CC;

$darken-color:     darken( $base-color, 20% );
$lighten-color:    lighten( $base-color, 20% );
$saturate-color:   saturate( $base-color, 50% );
$desaturate-color: desaturate( $base-color, 20% );
$hue-color:        adjust-hue( $base-color, 50% );
$opacity-color:    rgba( $base-color, .5 );
$tint-color:       tint( $base-color, 50% );
$shade-color:      shade( $base-color, 50% );

// dynamically changes the text color based on the lightness of the primary color: http://thesassway.com/intermediate/dynamically-change-text-color-based-on-its-background-with-sass
@function set-text-color($color) {
  @if (lightness($color) >= 50) {
    @return #000000; // Lighter backgorund, return dark color
  } @else {
    @return #ffffff; // Darker background, return light color
  }
}
 
// centers the text in the box
@mixin vertical-align {
  margin: 0;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

// creates the swatch boxes
.swatch {
  background: $base-color;
  display: block;
  float: left;
  margin: 5px;
  text-align: center; 
  width: calc(100% / 3 - 10px);
  height: calc(100vh / 3 - 15px);

  pre {
    @include vertical-align;
  }
}

// adjusting each box color
.darken {
  background-color: $darken-color;
  color: set-text-color($darken-color);
}

.lighten {
  background-color: $lighten-color;
  color: set-text-color($lighten-color);
}

.saturate {
  background-color: $saturate-color;
  color: set-text-color($saturate-color);
}

.desaturate {
  background-color: $desaturate-color;
  color: set-text-color($desaturate-color);
}

.adjust-hue {
  background-color: $hue-color;
  color: set-text-color($hue-color);
}

.adjust-opacity {
  background-color: $base-color;
  background-color: $opacity-color;
  color: set-text-color($opacity-color);
}

.adjust-tint {
  background-color: $tint-color;
  color: set-text-color($tint-color);
}

.adjust-shade {
  background-color: $shade-color;
  color: set-text-color($shade-color);
}
            
          
!
999px
Loading ..................

Console