DAWLAB Color Palette

by Arete

HTML

<div class="color-list">
 
<section class="color" style="background: hsla(157, 100%, 31%, 1);">
<h2 class="name">Green Haze</h2>
<ul class="details">
<li>#009c61</li>
<li>rgb(0,156,97)</li>
<li>rgba(0, 156, 97, 1)</li>
<li>hsla(157, 100%, 31%, 1)</li>
</ul>
</section>

<section class="color" style="background: hsla(315, 100%, 40%, 1);">
<h2 class="name">Hollywood Cerise</h2>
<ul class="details">
<li>#cc0099</li>
<li>rgb(204,0,153)</li>
<li>rgba(204, 0, 153, 1)</li>
<li>hsla(315, 100%, 40%, 1)</li>
</ul>
</section>

<section class="color" style="background: hsla(45, 100%, 40%, 1);">
<h2 class="name">Buddha Gold</h2>
<ul class="details">
<li>#cc9900</li>
<li>rgb(204,153,0)</li>
<li>rgba(204, 153, 0, 1)</li>
<li>hsla(45, 100%, 40%, 1)</li>
</ul>
</section>

<section class="color" style="background: hsla(345, 100%, 40%, 1);">
<h2 class="name">Monza</h2>
<ul class="details">
<li>#cc0033</li>
<li>rgb(204,0,51)</li>
<li>rgba(204, 0, 51, 1)</li>
<li>hsla(345, 100%, 40%, 1)</li>
</ul>
</section>

<section class="color" style="background: hsla(195, 100%, 40%, 1);">
<h2 class="name">Pacific Blue</h2>
<ul class="details">
<li>#0099cc</li>
<li>rgb(0,153,204)</li>
<li>rgba(0, 153, 204, 1)</li>
<li>hsla(195, 100%, 40%, 1)</li>
</ul>
</section>

<section class="color" style="background: hsla(270, 100%, 40%, 1);">
<h2 class="name">Purple</h2>
<ul class="details">
<li>#6600cc</li>
<li>rgb(102,0,204)</li>
<li>rgba(102, 0, 204, 1)</li>
<li>hsla(270, 100%, 40%, 1)</li>
</ul>
</section>

<section class="color" style="background: hsla(90, 100%, 40%, 1);">
<h2 class="name">Limenade</h2>
<ul class="details">
<li>#66cc00</li>
<li>rgb(102,204,0)</li>
<li>rgba(102, 204, 0, 1)</li>
<li>hsla(90, 100%, 40%, 1)</li>
</ul>
</section>

<section class="color" style="background: hsla(0, 0%, 80%, 1);">
<h2 class="name">Silver</h2>
<ul class="details">
<li>#cccccc</li>
<li>rgb(204,204,204)</li>
<li>rgba(204, 204, 204, 1)</li>
<li>hsla(0, 0%, 80%, 1)</li>
</ul>
</section>

<section class="color"...

CSS

body {
  font-family: 'Open Sans', sans-serif;
}

* {
  /* Ensure sane sizing of all elements */
  box-sizing: border-box; 
}

.color-list {
  display: flex;
  /* 
    On small displays we want each .color stacked.
    Flexbox let's us determine stacking direction via
    flex-direction: column;
  */
  flex-direction: column;
  height: 100vh;
}

.color {
  /*
    Each .color is also a flex item. We do this so that we have reasonable
    distribution of space between elements. We use flex-direction so that
    flexbox knows which way to position each element (in this case, vertical).
  */
  display: flex;
  flex-direction: column;
  
  /*
    .color can grow but not shrink (we want space for first three elements).
    10em is enough space to see name, hsl, and hex values. 
    Try shrinking vertically on a small display.
  */
  flex: 1 0 10em;  
  box-shadow: 0 0 30px #424242;
  
  /* Handles any clipping/overflow issues on transition */
  overflow: hidden;
  padding: 1em;
  color: white;
  transition: flex-basis 100ms ease-in-out;
}

.color:hover {
  /*
    Change the flex-basis so that we know what
    size to transition to on hover. Arbitrary,
    based on our design/content.
  */
  flex-basis: 20em;
}

.color:hover .details {
  opacity: 1;
}

.name {
  font-size: 1.2em;
  font-weight: 600;
}

.details {
  margin: 0;
  padding: 0;
  list-style: none;
  opacity: 0;
  transition: opacity 100ms ease-in-out;
}

.details li {
  font-size: 1em;
  line-height: 2em;
}

@media (min-width: 1920px) {
  .color-list {
    /*
      Change the direction so that each .color
      aligns horizontally
    */
    flex-direction: row;
  }
  
  .color {
    /*
      No scrollbars on mobile
    */
    flex-shrink: 1;
  }
}

/* Fonts, OK at the end for this demo! */
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600);