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.

  <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>

<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">
  <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">
  <h2>Quantity Example</h2>
  <p>Groups of colors can vary in quantity and the grid will automatically adapt.</p>
  <ul class="gray">
              // 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
          &: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



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

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

body {margin:0;}

* {box-sizing: border-box;}

h1 {
  margin:0 auto 15px;
  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 {
  h1 {color:#c0c5ce}
  p {color:#96b5b4;margin-bottom:12px;}

section {
    padding:1.2rem 1.2rem 0;
    @media @tablet {width:90%}
    @media @mobile {width:96%}
    margin:30px auto;
    @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%;
        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 {
    li {
        #grid > .cell;
        &:before {
            display: block;
            font-weight: bold;
        padding:10px 0;
    } // li
} // ul

/*  THE GRID  */
@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%;
    @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%}
    @total: @columns) {
        left: percentage((@column-width + @gutter-width) * @cols / (@column-width * @total + @gutter-width * (@total - 1)));
    @total: @columns) {
        left: percentage((@column-width + @gutter-width) * -@cols / (@column-width * @total + @gutter-width * (@total - 1)));
    @total: @columns) {
        margin-left: percentage((@column-width + @gutter-width) * @cols / (@column-width * @total + @gutter-width * (@total - 1)));
    @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)";
🕑 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.