Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              <html>
  <head>
  </head>
  <body>
    <!-- custom handle svg -->
    <svg style="display:none;">
      <defs>
        <g id="handle" stroke-width="2" >
            <path d="M8,20.6866828 C12.9049067,16.4171007 15,12.3469645 15,8 C15,4.13400675 11.8659932,1 8,1 C4.13400675,1 1,4.13400675 1,8 C1,12.3469645 3.09509325,16.4171007 8,20.6866828 Z M8,13 C5.23857625,13 3,10.7614237 3,8 C3,5.23857625 5.23857625,3 8,3 C10.7614237,3 13,5.23857625 13,8 C13,10.7614237 10.7614237,13 8,13 Z" stroke="#FFFFFF" stroke-width="2" fill="#FFFFFF"></path>
        </g>
      </defs>
    </svg>
    <!-- / custom handle svg -->
    <div class="wrap">
      <div class="half">
        <div class="colorPicker"></div>
      </div>
      <div class="half readout">
        <span class="title">Values:</span>
        <div id="values"></div>
        <span class="title link">Check out <a href="https://iro.js.org?ref=codepen">https://iro.js.org</a> for more info!</span>
      </div>
    </div>
  </body>
</html>
            
          
!

CSS

            
              body {
  color: #fff;
  background: #171F30;
}

.wrapper svg {
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  
  .half {
    width: 50%;
    padding: 32px 0;
  }
}

.title {
  font-family: sans-serif;
  line-height: 24px;
  display: block;
  padding: 8px 0;
}

.readout {
  margin-top: 32px;
  font-family: monospace;
}

.link {
  margin-top: 16px;
  
  a {
    color: MediumSlateBlue;
  }
}
            
          
!

JS

            
              // Create a new color picker instance
// https://iro.js.org/guide.html#Getting-Started
var colorPicker = new iro.ColorPicker(".colorPicker", {
  // color picker options
  // Option guide: https://iro.js.org/guide.html#Color-Picker-Options
  width: 280,
  color: "rgb(255, 0, 0)",
  borderWidth: 1,
  borderColor: "#fff",
  handleSvg: '#handle',
  handleProps: {x: -8, y: -20}
});

var values = document.getElementById("values");

// https://iro.js.org/guide.html#color-change
colorPicker.on(["color:init", "color:change"], function(color){
  // Show the current color in different formats
  // Using the selected color: https://iro.js.org/guide.html#Using-the-Selected-Color
  values.innerHTML = [
    "hex: " + color.hexString,
    "rgb: " + color.rgbString,
    "hsl: " + color.hslString,
  ].join("<br>");
});
            
          
!
999px

Console