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


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.


                <h1><a href="" target="_blank">vanilla-picker-mini</a> demo</h1>

    <h2>Basic example</h2>
    <a href="#" class="button" id="basic">Click me!</a>

    <h2>More <a href="">options</a></h2>
    <a href="#" class="button" id="custom">Click me (and then 'Ok')!</a>

<section id="shared">
    <h2>Shared picker</h2>
    <p>Select background colors:</p>
    <div class="pickers">
        <a href="#" class="button picker_sample" id="color-bg"    data-color="#fff"></a>
        <a href="#" class="button picker_sample" id="color-line1" data-color="rgba(30,144,255, 0.2)"></a>
        <a href="#" class="button picker_sample" id="color-line2" data-color="rgba(255,99,71, 0.3)"></a>

    <h2>Fixed (non-popup) picker</h2>
    <div id="fixed"></div>


                body {
    display: flex;
    flex-flow: column nowrap;
    min-height: 100vh;
    margin: 0;
    align-items: center;

    font-family: Georgia, sans-serif;
    font-size: 18px;
    //background: radial-gradient(honeydew, lightgreen);
    background-color: pink;
h1 {
    align-self: stretch;
    margin: 0;
    padding: 1em 0;
    text-align: center;
    background: rgba(white, .8);
h2 {
    margin-top: 0;
    font-size: 1.3em;
section {
    width: 100%;
    max-width: 500px;
    margin-top: 3em;
    padding: 1em;
    border: 1em solid transparent;
    box-sizing: border-box;
    background: rgba(white, .7);
    background-clip: padding-box;
    &::last-of-type {
        margin-bottom: 1em;

.button {
    position: relative;
    display: inline-block;
    box-sizing: border-box;
    padding: .5em 1em;
    min-height: 2em;
    border: none;
    outline: none;
    overflow: visible;
    background-color: dodgerblue;
    color: white;

    font-family: sans-serif;
    text-align: center;
    cursor: pointer;
    &:hover {
        //background-image: linear-gradient(white, transparent);
    &:focus {
        outline: .3em dashed orange;

#shared {
    h2 {
        margin-bottom: 2em;
    .pickers {
        display: inline-flex;
        padding: .5em;
        background-color: gainsboro;
        border: 1px solid silver;

        .button {
            background-color: white;
            &:not(:last-child) {
                margin-right: .5em;

            &::before {
                top:0; left:0;

#fixed {
    display: table;
    padding: 1em;
    border: 1px solid silver

@media(max-width: 400px) {
    .picker_wrapper.popup {
        font-size: 2vw !important;



function $(selector) { return document.querySelector(selector); }

/* Basic example */

const parentBasic = $('#basic'),
      popupBasic = new Picker(parentBasic);
popupBasic.onChange = function(color) { = color.rgbaString();
//Open the popup manually:

/* More options */

const parentCustom = $('#custom'),
      popupCustom = new Picker({
          parent: parentCustom,
          popup: 'top',
          color: '#ee82ee',
          //alpha: false,
          //editor: false,
          onDone: function(color) {
     = color.rgbaString();

/* Shared picker */

const parentShared = $('#shared'),
      parentBG = $('#color-bg'),
      popupShared = new Picker({
          popup: 'top',
          onChange: function(color) {
              this.settings.parent.setAttribute('data-color', color.rgbaString());

//Picker switching:
parentShared.addEventListener('click', function(e) {
    if( !== 'A') { return; }
    const parent =;

        parent: parent,
        color: parent.getAttribute('data-color'),
        //Future feature...
        //alpha: (parent !== parentBG),
    }, true);

//Color handling:
function updateBackground() {
    function updateElement(elm) {
        const color = = elm.getAttribute('data-color');
        return color;

    const body = document.body,
          c1 = updateElement($('#color-line1')),
          c2 = updateElement($('#color-line2')),
          patternSize = 200,
          pattern = `repeating-linear-gradient( 0deg, transparent 0, transparent ${patternSize * .6}px, ${c2} 0, ${c2} ${patternSize * .8}px, transparent 0, transparent ${patternSize}px),
                     repeating-linear-gradient(90deg, transparent 0, transparent ${patternSize * .6}px, ${c2} 0, ${c2} ${patternSize * .8}px, transparent 0, transparent ${patternSize}px),
                     repeating-linear-gradient( 0deg, ${c1} 0, ${c1} ${patternSize * .4}px, transparent 0, transparent ${patternSize}px),
                     repeating-linear-gradient(90deg, ${c1} 0, ${c1} ${patternSize * .4}px, transparent 0, transparent ${patternSize}px)`; = updateElement(parentBG); = pattern;

/* Fixed picker */

const parentFixed = $('#fixed'),
      pickerFixed = new Picker({
          parent: parentFixed,
          popup: false,
          alpha: false,
          editor: false,
          color: '#ff4500',
          onChange: function(color) {
     = color.rgbaString();
//Set the color silently (doesn't trigger .onChange()):
pickerFixed.setColor('#0f0', true);

/* Disable normal link navigation */

[parentBasic, parentCustom].forEach(p => {
    p.addEventListener('click', function(e) {