css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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>Charles Hayter's Colour Diagrams</h1>
<div class="example-wrapper">
  <div class="grid1">
    <div class="grid__item yel1">
      <p>yellow</p>
    </div>
    <div class="grid__item yel2">
      <p>yellow</p>
    </div>
    <div class="grid__item red1">
      <p>red</p>
    </div>
    <div class="grid__item org1">
      <p>orange</p>
    </div>
    <div class="grid__item org2">
      <p>orange</p>
    </div>
    <div class="grid__item grn1">
      <p>green</p>
    </div>
    <div class="grid__item olv1">
      <p>olive</p>
    </div>

    <div class="grid__item red2">
      <p>red</p>
    </div>
    <div class="grid__item yel3">
      <p>yellow</p>
    </div>
    <div class="grid__item blu1">
      <p>blue</p>
    </div>
    <div class="grid__item grn2">
      <p>green</p>
    </div>
    <div class="grid__item org3">
      <p>orange</p>
    </div>
    <div class="grid__item prp1">
      <p>purple</p>
    </div>
    <div class="grid__item brn1">
      <p>brown</p>
    </div>

    <div class="grid__item blu2">
      <p>blue</p>
    </div>
    <div class="grid__item red3">
      <p>red</p>
    </div>
    <div class="grid__item blu3">
      <p>blue</p>
    </div>
    <div class="grid__item prp2">
      <p>purple</p>
    </div>
    <div class="grid__item grn3">
      <p>green</p>
    </div>
    <div class="grid__item prp3">
      <p>purple</p>
    </div>
    <div class="grid__item slt1">
      <p>slate</p>
    </div>
  </div>
  
  <div class="grid2">
    <div class="grid__item yel4">
      <p>yellow</p>
    </div>
    <div class="grid__item red4">
      <p>red</p>
    </div>
    <div class="grid__item blu4">
      <p>blue</p>
    </div>
    
    <div class="grid__item org4">
      <p>orange</p>
    </div>
    <div class="grid__item grn4">
      <p>green</p>
    </div>
    <div class="grid__item prp4">
      <p>purple</p>
    </div>
    
    <div class="grid__item olv2">
      <p>olive</p>
    </div>
    <div class="grid__item brn2">
      <p>brown</p>
    </div>
    <div class="grid__item slt2">
      <p>slate</p>
    </div>
  </div>
</div>

<div class="axioms">
  <h2>AXIOMS.</h2>
  <p><em>First</em>—That Yellow, Red, and Blue, are entire colours of themselves, and cannot be produced by the mixture of any other colours.–<em>See Plate I</em>.</p>
  <p><em>Secondly</em>—Yellow, Red, and Blue, contain the sole properties of producing all other colours whatsoever, as to colour, by mixtures arising entirely among themselves, without the aid of a fourth;–</p>
  <p><em>Thirdly</em>—Because, by mixing proper portions of the Three Primitives together, Black is obtained, providing for every possible degree of shadow.</p>
  <p><em>Fourthly</em>—And every practical degree of <em>light</em> is obtained by diluting any of the colours, as above producible ; or in oil-painting, by the mixture of white paint.</p>
  <p><em>Fifthly</em>—All transient or prismatic effects can be imitated with the Three Primitive Colours, as permanently considered, but only in the same degree of comparison as white bears to light.</p>
  <p><em>Sixthly</em>—There are no other materials, in which colour is found, that are possessed of any of the foregoing perfections.</p>
</div>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Old+Standard+TT:400,400i');

$red: #c10909;
$orange: #e13e00;
$yellow: #e3ac00;
$green: #5e9077;
$olive: #83652d;
$blue: #3889b7;
$purple: #4f437d;
$brown: #752435;
$slate: #38416f;

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  background-image: radial-gradient(#e2d0b3, #e6ccaa);
  font-family: 'Old Standard TT', serif;
  padding: 0.5em;
}

// Responsive typography
$min-width: 320;
$max-width: 960;
$min-font: 18;
$max-font: 22;

:root {
  font-size: #{$min-font}px;
}

@media (min-width: #{$min-width}px) and (max-width: #{$max-width}px) {
  :root {
    font-size: calc( #{$min-font}px + (#{$max-font} - #{$min-font}) * ( (100vw - #{$min-width}px) / ( #{$max-width} - #{$min-width})));
  }
}

@media (min-width: #{$max-width}px) {
  :root {
    font-size: #{$max-font}px;
  }
}

h1 {
  text-align: center;
  font-size: 5vw;
  margin-bottom: 0.5em;
}

h2 {
  text-align: center;
  font-size: 3vw;
  margin-bottom: 0.5em;
}

p {
  line-height: 1.2;
  margin-bottom: 1em;
}

em {
  font-style: italic;
}

.example-wrapper::before {
  content: 'This example requires a browser that supports CSS Grid, like Firefox Nightly. If your browser did support CSS Grid, you would have seen something that resembled the image below, except recreated in HTML and CSS instead.';
  display: inline-block;
  margin-bottom: 1em;
  line-height: 1.2;
}

.example-wrapper::after {
  content: url('https://upload.wikimedia.org/wikipedia/commons/1/15/Color_diagram_Charles_Hayter.jpg');
  display: block;
  text-align: center;
}

.example-wrapper > * {
  display: none;
}

.example-wrapper {
  background: $red;
  padding: 5vmin;
  margin-bottom: 1em;
}

.axioms {
  max-width: 40em;
  margin: 0 auto;
}

@supports (display: grid) {
  .example-wrapper::before,
  .example-wrapper::after {
    content: none;
  }

  .example-wrapper {
    display: block;
    background-color: inherit;
    border: 0.2vw solid;
    
    p {
      font-style: italic;
      font-size: 1.5vw;
      margin: 0;
    }
  }
  
  .grid1 {
    display: grid;
    grid-template-columns: repeat(3, 2vw 5vw 5vw 5vw 5vw 5vw 2vw);
    grid-auto-rows: 15vw;
    grid-gap: 0.1vw;
    justify-content: center;

    margin-bottom: 1em;
  }

  .grid__item {
    border-radius: 50%;
    border: 0.1vw solid;
    box-shadow: 0px 0px 0px 0.4vw white, 0px 0px 0px 0.5vw black;

    display: flex;
    align-items: center;
    justify-content: center;
  }

  .yel1 {
    grid-row: 1;
    grid-column: 3 / span 3;
    background-color: $yellow;
  }

  .yel2 {
    grid-row: 2;
    grid-column: 2 / span 3;
    background-color: $yellow;
    mix-blend-mode: soft-light;
  }

  .red1 {
    grid-row: 2;
    grid-column: 4 / span 3;
    background-color: $red;
  }

  .org1 {
    grid-row: 3;
    grid-column: 3 / span 3;
    background-color: $orange;
  }

  .org2 {
    grid-row: 4;
    grid-column: 2 / span 3;
    background-color: $orange;
    mix-blend-mode: soft-light;
  }

  .grn1 {
    grid-row: 4;
    grid-column: 4 / span 3;
    background-color: $green;
  }

  .olv1 {
    grid-row: 5;
    grid-column: 3 / span 3;
    background-color: $olive;
  }

  .red2 {
    grid-row: 1;
    grid-column: 10 / span 3;
    background-color: $red;
  }

  .yel3 {
    grid-row: 2;
    grid-column: 9 / span 3;
    background-color: $yellow;
    mix-blend-mode: soft-light;
  }

  .blu1 {
    grid-row: 2;
    grid-column: 11 / span 3;
    background-color: $blue;
  }

  .grn2 {
    grid-row: 3;
    grid-column: 10 / span 3;
    background-color: $green;
  }

  .org3 {
    grid-row: 4;
    grid-column: 9 / span 3;
    background-color: $orange;
    mix-blend-mode: soft-light;
  }

  .prp1 {
    grid-row: 4;
    grid-column: 11 / span 3;
    background-color: $purple;
  }

  .brn1 {
    grid-row: 5;
    grid-column: 10 / span 3;
    background-color: $brown;
  }

  .blu2 {
    grid-row: 1;
    grid-column: 17 / span 3;
    background-color: $blue;
  }

  .red3 {
    grid-row: 2;
    grid-column: 16 / span 3;
    background-color: $red;
    mix-blend-mode: soft-light;
  }

  .blu3 {
    grid-row: 2;
    grid-column: 18 / span 3;
    background-color: $blue;
  }

  .prp2 {
    grid-row: 3;
    grid-column: 17 / span 3;
    background-color: $purple;
  }

  .grn3 {
    grid-row: 4;
    grid-column: 16 / span 3;
    background-color: $green;
    mix-blend-mode: soft-light;
  }

  .prp3 {
    grid-row: 4;
    grid-column: 18 / span 3;
    background-color: $purple;
  }

  .slt1 {
    grid-row: 5;
    grid-column: 17 / span 3;
    background-color: $slate;
  }
  
  .grid2 {
    display: grid;
    grid-template-columns: repeat(3, 0.5vw 6vw 6vw 6vw 6vw 6vw 0.5vw);
    grid-auto-rows: 9vw;
    grid-gap: 0.1vw;
    justify-content: center;
  }

  .yel4 {
    grid-row: 1 / span 2;
    grid-column: 2 / span 3;
    background-color: $yellow;
    mix-blend-mode: soft-light;
  }

  .red4 {
    grid-row: 1 / span 2;
    grid-column: 4 / span 3;
    background-color: $red;
    mix-blend-mode: soft-light;
  }

  .blu4 {
    grid-row: 2 / span 2;
    grid-column: 3 / span 3;
    background-color: $blue;
  }

  .org4 {
    grid-row: 1 / span 2;
    grid-column: 10 / span 3;
    background-color: $orange;
    mix-blend-mode: soft-light;
  }

  .grn4 {
    grid-row: 2 / span 2;
    grid-column: 9 / span 3;
    background-color: $green;
  }

  .prp4 {
    grid-row: 2 / span 2;
    grid-column: 11 / span 3;
    background-color: $purple;
    mix-blend-mode: soft-light;
  }

  .olv2 {
    grid-row: 1 / span 2;
    grid-column: 16 / span 3;
    background-color: $olive;
    mix-blend-mode: soft-light;
  }

  .brn2 {
    grid-row: 1 / span 2;
    grid-column: 18 / span 3;
    background-color: $brown;
    mix-blend-mode: soft-light;
  }

  .slt2 {
    grid-row: 2 / span 2;
    grid-column: 17 / span 3;
    background-color: $slate;
  }
}
            
          
!
            
              /*
An attempt to recreate the colour diagrams in Charles Hayter's “A New Practical Treatise on the Three Primitive Colours Assumed as a Perfect System of Rudimentary Information”. Original text available at https://archive.org/details/newpracticaltrea00hayt.
*/
            
          
!
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.
Loading ..................

Console