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

Packages

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.

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.

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.

HTML

              
                <button type="button" class="Button Button--amazon">Add to cart</button>
              
            
!

CSS

              
                $base-btn-color: #f0c14b
// $base-btn-color: #46c16f
// $base-btn-color: #fcbf14

.Button
    display: inline-block
    position: relative
    text-align: center
    text-decoration: none
    cursor: pointer
    border: 0
    border-radius: 2px
    background-color: transparent
    vertical-align: top
    white-space: nowrap
    text-rendering: auto
    user-select: none
    letter-spacing: 0
    font-weight: 400
    font-style: normal
    box-shadow: none
    padding-top: 10px
    padding-bottom: 10px
    color: rgba(black,.44)
    fill: rgba(black,.44)
    transition: all .2s ease
    &:hover
        color: rgba(black,.66)
        fill: rgba(black,.66)

    &:focus,
    &:active
        outline: none
    
.Button--amazon
    width: 204px
    height: 31px
    padding: 0
    color: #111
    font-size: 14px
    border-style: solid
    border-width: 1px
    background-color: $base-btn-color
    border-color: darken($base-btn-color, 25%) darken($base-btn-color, 30%) darken($base-btn-color, 35%)
    background: linear-gradient(to bottom, lighten($base-btn-color, 18%), $base-btn-color)
    // border-color: darken($base-btn-color, 10%) darken($base-btn-color, 15%) darken($base-btn-color, 20%)
    // background: linear-gradient(to bottom, lighten($base-btn-color, 25%), $base-btn-color)
              
            
!

JS

              
                console.log(color_meter('#f0c14b','#846a29'))

function color_meter(cwith, ccolor) {
    
    if (!cwith && !ccolor) return;
    
    var _cwith  = (cwith.charAt(0)=="#") ? cwith.substring(1,7) : cwith;
    var _ccolor = (ccolor.charAt(0)=="#") ? ccolor.substring(1,7) : ccolor;
    
    var _r = parseInt(_cwith.substring(0,2), 16);
    var _g = parseInt(_cwith.substring(2,4), 16);
    var _b = parseInt(_cwith.substring(4,6), 16);

    var __r = parseInt(_ccolor.substring(0,2), 16);
    var __g = parseInt(_ccolor.substring(2,4), 16);
    var __b = parseInt(_ccolor.substring(4,6), 16);
    
    var p1 = (_r / 255) * 100;
    var p2 = (_g / 255) * 100;
    var p3 = (_b / 255) * 100;

    var perc1 = Math.round((p1 + p2 + p3) / 3);
    
    var p1 = (__r / 255) * 100;
    var p2 = (__g / 255) * 100;
    var p3 = (__b / 255) * 100;
    
    var perc2 = Math.round((p1 + p2 + p3) / 3);
    
    return Math.abs(perc1 - perc2);   
}
              
            
!
999px

Console