123

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <header>
  <h1>Automagic <span>C</span><span>o</span><span>l</span><span>o</span><span>r</span> Palette</h1>
  <p>Dynamic color style guide created from LESS variables</p>
</header>

<section class="color-palette">
  <h2>Color Group Name</h2>
  <p>Brief usage description, Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
  <ul class="example">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
  </ul>
  <h2>Example Colors</h2>
  <p>Color name and value are automatically appended via CSS, and conditionally colored based on the original value, to ensure readability.</p>
  <ul class="quantity-example">
    <li></li>
    <li></li>
    <li></li>
  </ul>
  <h2>Quantity Example</h2>
  <p>Groups of colors can vary in quantity and the grid will automatically adapt.</p>
  <ul class="gray">
    <li></li>
  </ul>
</section>
            
          
!
            
              // Colors Mixin
.colors (@color) {
   .-(@i: length(@color)) when (@i > 0) {
        @name: e(extract(@color, @i));
        li:nth-child(@{i}) {
          background: @@name;// the color!
          
          @dark: darken(saturate(@@name, 100%), 70%);// create new dark color
          @mid: darken(saturate(@@name, 100%), 50%);// create new mid color
          @light: lighten(@@name, 55%);// create new light color
          @bright: lighten(@@name, 70%);// create new really light color
          .mixin (@colorVal) when (lightness(@colorVal) >= 80%) {color: @dark;}// when really light lightness
          .mixin (@colorVal) when (lightness(@colorVal) < 80%)
                             and (lightness(@colorVal) > 69%) {color: @mid;}// when light lightness
          .mixin (@colorVal) when (lightness(@colorVal) <= 69%)
                             and (lightness(@colorVal) > 36%)
                             and (hue(@colorVal) >= 40%)
                             and (hue(@colorVal) <= 75%) {color:@mid;}// when mid lightness, but yellow
          .mixin (@colorVal) when (lightness(@colorVal) <= 69%)
                             and (lightness(@colorVal) > 36%)
                             and (hue(@colorVal) < 40%) {color: @light;}// when mid lightness
          .mixin (@colorVal) when (lightness(@colorVal) <= 69%)
                             and (lightness(@colorVal) > 36%)
                             and (hue(@colorVal) > 75%) {color: @light;}// when mid lightness
          .mixin (@colorVal) when (lightness(@colorVal) <= 36%) {color: @bright;}// when dark lightness
          .mixin(@@name);
          
          &:before {content: "@{name}"}// show color variable name
          &:after {content: %("%a", @@name);}// show color variable value
        }
        .-((@i - 1));
    } .-;
    @quantity: length(@color);// number of colors in list
    li {#grid > .span(12/@quantity);}// set grid span
}

// Color Variables
@coolBlue:#389aff;

@cosmicOrange:#f16745;
@canaryYellow:#ffe25d;
@mintGreen:#7bc8a4;
@oceanBlue:#4cc3d9;
@orchidPurple:#93648d;
@plainJane:#404040;

@rocketRed:#bf2431;
@purple:#5e308c;
@forestGreen:#197359;

.color-palette {
  ul.gray {.colors ('coolBlue';);}
  ul.example {.colors ('cosmicOrange','canaryYellow','mintGreen','oceanBlue','orchidPurple','plainJane';);}
  ul.quantity-example {.colors ('rocketRed','purple','forestGreen';);}
}




// Irrelevant Styling
html,
body {
    font-size: 10px;
    background: #e5ebf4;
    font-family: 'Open Sans', sans-serif;
}

body {margin:0;}

* {box-sizing: border-box;}

h1 {
  position:relative;
  margin:0 auto 15px;
  width:auto;
  padding-bottom:15px;
  font-size:4.1rem;
  font-weight:300;
  letter-spacing: -0.15rem;
  &:after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 0;
  height: 2px;
  width: 100%;
  background: #bf616a;
  background: linear-gradient(left, transparent 0%,#bf616a 50%,transparent 100%);
 }
  span {
    &:nth-of-type(1) {color:white}
    &:nth-of-type(2) {color:yellow}
    &:nth-of-type(3) {color:#ff005a}
    &:nth-of-type(4) {color:#00d2ff}
    &:nth-of-type(5) {color:#00ff8a}
  }
}
h2 {margin:0;font-size:1.8rem;font-weight:600;}
p {font-size:1.65rem;margin:0 0 5px 0;font-weight:400;}

header {
  background:#2b303b;
  text-align:center;
  padding:34px;
  h1 {color:#c0c5ce}
  p {color:#96b5b4;margin-bottom:12px;}
}

section {
    position:relative;
    padding:1.2rem 1.2rem 0;
    width:80%;
    @media @tablet {width:90%}
    @media @mobile {width:96%}
    margin:30px auto;
    @clrTop:#fff;
    @clrBottom: #e5ebf4;
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(@clrTop), to(@clrBottom)); // Safari 4-5, Chrome 1-9
    background: -webkit-linear-gradient(top, @clrBottom, @clrTop); // Safari 5.1, Chrome 10+
    background: -moz-linear-gradient(top, @clrBottom, @clrTop); // Firefox 3.6+
    background: -ms-linear-gradient(top, @clrBottom, @clrTop); // IE 10
    background: -o-linear-gradient(top, @clrBottom, @clrTop); // Opera 11.10+
    background-color: #fff;
    background-size: 100% 100px;
    background-repeat: no-repeat;
    border: 2px solid white;
    border-radius: 24px;
    box-shadow: 0 0 14px #bec9d8;
    &:before {
        content: "";
        position: absolute;
        z-index: -1;
        width: 96%;
        bottom: 0;
        height: 20px;
        left: 2%;
        padding-bottom:0px;
        border-bottom: 2px solid red;
        border-radius: 50%;
        box-shadow: 0 0 0px 3px #bbb, 0 0 0px 4px #eee, 0 0 0px 6px #fff, 0 0 32px #101215;
    } // shadow
  > *:last-child {margin-bottom:0;}
} // section

ul {
    #grid;
    list-style:none;
    padding:0;
    margin-bottom:12px;
    li {
        #grid > .cell;
        &:before {
            display: block;
            font-weight: bold;
        }
        border-radius:12px;
        padding:10px 0;
        text-align:center;
    } // li
} // ul




/*  THE GRID justifygrid.com  */
@columns: 12;
@column-width: 4rem;
@gutter-width: 1.2rem;
@support-old-ie: false;
#grid() {
    text-align: justify !important;
    text-justify: distribute-all-lines;
    font-size: 0 !important;
    & > * {
        text-align: left;
        font-size: medium;
    }
    &:after {
        content: '';
        display: inline-block;
        width: 100%;
    }
    .cell() {
        vertical-align: top;
        display: inline-block;
        width: 100%;
    }
    .span(@cols,
    @total: @columns) {
        width: percentage((@column-width * @cols + @gutter-width * (@cols - 1)) / (@column-width * @total + @gutter-width * (@total - 1)));
        margin-bottom: 1.2rem;
        @media @desktop {min-width: 23.52941176%;}
        @media @tablet {min-width: 32.02614379%}
        @media @mobile {min-width: 100%}
    }
    .push(@cols,
    @total: @columns) {
        left: percentage((@column-width + @gutter-width) * @cols / (@column-width * @total + @gutter-width * (@total - 1)));
    }
    .pull(@cols,
    @total: @columns) {
        left: percentage((@column-width + @gutter-width) * -@cols / (@column-width * @total + @gutter-width * (@total - 1)));
    }
    .prepend(@cols,
    @total: @columns) {
        margin-left: percentage((@column-width + @gutter-width) * @cols / (@column-width * @total + @gutter-width * (@total - 1)));
    }
    .append(@cols,
    @total: @columns) {
        margin-right: percentage((@column-width + @gutter-width) * @cols / (@column-width * @total + @gutter-width * (@total - 1)));
    }
}

@mobile: ~"only screen and (max-width: 529px)";
@tablet: ~"only screen and (min-width: 530px) and (max-width: 768px)";
@desktop:     ~"only screen and (min-width: 769px) and (max-width: 1128px)";
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console