Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

              
                doctype html
head
  meta(charset="utf-8")
  link(rel="stylesheet", href="/styl.css", media="screen", charset="utf-8")
  script(type="text/javascript", src="//code.jquery.com/jquery-1.12.0.min.js")
  script(type="text/javascript", src="script.js")
  title Color picker
body
  .shadowBox
  .container
    .blueSub
    .redSub
    .greenSub
    .purpleSub
    .blue
      .colorName Blue
      .hex #00A8FF
      .rgb rgb(0, 168, 255)
    .red
      .colorName Red
      .hex #FF605F
      .rgb rgb(255, 96, 95)
    .green
      .colorName Green
      .hex #96D100
      .rgb rgb(150, 209, 0)
    .purple
      .colorName Purple
      .hex #D066FA
      .rgb rgb(208, 102, 250)

              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Lato:300)

$blue = rgba(0, 168, 255, 1)
$blue10 = rgba(0, 168, 255, .1)
$blue20 = rgba(0, 168, 255, .2)
$blueDark = rgba(0, 94, 142, 1)
$red = rgba(255, 96, 95, 1)
$red10 = rgba(255, 96, 95, .1)
$red20 = rgba(255, 96, 95, .2)
$green = rgba(150, 209, 0, 1)
$green10 = rgba(150, 209, 0, .1)
$green20 = rgba(150, 209, 0, .2)
$purple = rgba(208, 102, 250, 1)
$purple10 = rgba(208, 102, 250, .1)
$purple20 = rgba(208, 102, 250, .2)
$containerColor = #fff
$containerWidth = 416px
$containerHeight = 128px
$containerBorderRadius = 16px
// $containerShadow = 0px 16px 32px rgba(0,0,0,.05)

*
  transition all .7s ease
  box-sizing border-box

body
  background $blue10
  display flex
  justify-content center
  align-items center
  width 100vw
  height 100vh
  font-family 'Lato', sans-serif
  font-weight 300
  overflow hidden
  .shadowBox
    position absolute
    background $blueDark
    width 376px
    height 96px
    z-index 0
    border-radius 16px
    margin-top 32px
    -webkit-filter blur(20px)
    opacity .2
    top 50%
    left 50%
    margin-left -188px
    margin-top -16px
    z-index -1
  .container
    background $containerColor
    width $containerWidth
    height $containerHeight
    border-radius $containerBorderRadius
    box-shadow $containerShadow
    color white
    font-size 16px
    z-index 1
    overflow hidden
    .blueSub, .redSub, .greenSub, .purpleSub
      position absolute
      width 80px
      height 80px
      border-radius 12px
      margin-top 24px
    .blueSub
      background $blue20
      margin-left 24px
      margin-top 24px
    .redSub
      background $red20
      margin-left 120px
      opacity 0
    .greenSub
      background $green20
      margin-left 216px
      opacity 0
    .purpleSub
      background $purple20
      margin-left 312px
      opacity 0
    .blue, .red, .green, .purple
      width 64px
      height 64px
      border-radius 8px
      z-index 2
      position absolute
      overflow hidden
    .blue
      background $blue
      margin-left 32px
      margin-top 32px
      &:hover
        cursor pointer
    .red
      background $red
      margin-top 32px
      margin-left 128px
      &:hover
        cursor pointer
    .green
      background $green
      margin-top 32px
      margin-left 224px
      &:hover
        cursor pointer
    .purple
      background $purple
      margin-top 32px
      margin-left 320px
      &:hover
        cursor pointer

.colorName, .hex, .rgb
  opacity 0
  position absolute
.colorName
  font-size 26px
  margin-top 9px
  left 16px
.hex
  margin-top 12px
  right 16px
.rgb
  margin-top 80px
  right 16px

              
            
!

JS

              
                $(document).ready ->

  count = 0

  # Colors
  blue10 = "rgba(0, 168, 255, .1)"
  red10 = "rgba(255, 96, 95, .1)"
  green10 = "rgba(150, 209, 0, .1)"
  purple10 = "rgba(208, 102, 250, .1)"

  blueDark = "rgba(0, 94, 142, 1)"
  redDark = "rgba(155, 3, 0, 1)"
  greenDark = "rgba(74, 103, 0, 1)"
  purpleDark = "rgba(110, 49, 134, 1)"

  $(".blue").on "mouseover", ->
    resetAllSubs()
    $(".blueSub").css("opacity":"1", "transition-delay": "0s")
    $("body").css("background":blue10, "transition-delay": "0s")
    $(".shadowBox").css("background":blueDark, "transition-delay": "0s")


  $(".red").on "mouseover", ->
    resetAllSubs()
    $(".redSub").css("opacity":"1", "transition-delay": "0s")
    $("body").css("background":red10, "transition-delay": "0s")
    $(".shadowBox").css("background":redDark, "transition-delay": "0s")

  $(".green").on "mouseover", ->
    resetAllSubs()
    $(".greenSub").css("opacity":"1", "transition-delay": "0s")
    $("body").css("background":green10, "transition-delay": "0s")
    $(".shadowBox").css("background":greenDark, "transition-delay": "0s")

  $(".purple").on "mouseover", ->
    resetAllSubs()
    $(".purpleSub").css("opacity":"1", "transition-delay": "0s")
    $("body").css("background":purple10, "transition-delay": "0s")
    $(".shadowBox").css("background":purpleDark, "transition-delay": "0s")

  $(".blue").on "click", ->
    if count > 1
      count = 0
    transformation("blue")
    count += 1

  $(".red").on "click", ->
    if count > 1
      count = 0
    transformation("red")
    count += 1

  $(".green").on "click", ->
    if count > 1
      count = 0
    transformation("green")
    count += 1

  $(".purple").on "click", ->
    if count > 1
      count = 0
    transformation("purple")
    count += 1

  resetAllSubs = () ->
    $(".blueSub").css("opacity":"0", "transition-delay": "0s")
    $(".redSub").css("opacity":"0", "transition-delay": "0s")
    $(".greenSub").css("opacity":"0", "transition-delay": "0s")
    $(".purpleSub").css("opacity":"0", "transition-delay": "0s")

  transformation = (layer) ->
    if count is 0
      switch layer
        when "blue"
          #Divs
          $(".blue").css("z-index": "3", "width":"400px", "height":"112px", "margin-top": "8px", "margin-left": "8px", "transition-delay": ".5s")
          $(".blueSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".05s")
          $(".red").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".1s")
          $(".redSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".075s")
          $(".green").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".15s")
          $(".greenSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".125s")
          $(".purple").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".2s")
          $(".purpleSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".175s")
          #Texts
          $(".blue .colorName").css("opacity": "1", "transition-delay": ".75s")
          $(".blue .hex").css("opacity": "1", "transition-delay": ".8s")
          $(".blue .rgb").css("opacity": "1", "transition-delay": ".85s")
        when "red"
          #Divs
          $(".red").css("z-index": "3", "width":"400px", "height":"112px", "margin-top": "8px", "margin-left": "8px", "transition-delay": ".5s")
          $(".redSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".05s")
          $(".blue").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".1s")
          $(".blueSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".075s")
          $(".green").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".15s")
          $(".greenSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".125s")
          $(".purple").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".2s")
          $(".purpleSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".175s")
          #Texts
          $(".red .colorName").css("opacity": "1", "transition-delay": ".75s")
          $(".red .hex").css("opacity": "1", "transition-delay": ".8s")
          $(".red .rgb").css("opacity": "1", "transition-delay": ".85s")
        when "green"
          #Divs
          $(".green").css("z-index": "3", "width":"400px", "height":"112px", "margin-top": "8px", "margin-left": "8px", "transition-delay": ".5s")
          $(".greenSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".05s")
          $(".blue").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".1s")
          $(".blueSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".075s")
          $(".red").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".15s")
          $(".redSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".125s")
          $(".purple").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".2s")
          $(".purpleSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".175s")
          #Texts
          $(".green .colorName").css("opacity": "1", "transition-delay": ".75s")
          $(".green .hex").css("opacity": "1", "transition-delay": ".8s")
          $(".green .rgb").css("opacity": "1", "transition-delay": ".85s")
        when "purple"
          #Divs
          $(".purple").css("z-index": "3", "width":"400px", "height":"112px", "margin-top": "8px", "margin-left": "8px", "transition-delay": ".5s")
          $(".purpleSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".05s")
          $(".blue").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".1s")
          $(".blueSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".075s")
          $(".red").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".15s")
          $(".redSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".125s")
          $(".green").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".2s")
          $(".greenSub").css("opacity": "0", "transform":"scale(0)", "transition-delay": ".175s")
          #Texts
          $(".purple .colorName").css("opacity": "1", "transition-delay": ".75s")
          $(".purple .hex").css("opacity": "1", "transition-delay": ".8s")
          $(".purple .rgb").css("opacity": "1", "transition-delay": ".85s")
    if count is 1
      switch layer
        when "blue"
          #Divs
          $(".blue").css("z-index": "2", "width":"64px", "height":"64px", "margin-top": "32px", "margin-left": "32px", "transition-delay": ".5s")
          $(".blueSub").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".8s")
          $(".red").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".9s")
          $(".redSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".875s")
          $(".green").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".95s")
          $(".greenSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".925s")
          $(".purple").css("opacity": "1", "transform":"scale(1)", "transition-delay": "1s")
          $(".purpleSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".975s")
          #Texts
          $(".blue .colorName").css("opacity": "0", "transition-delay": ".15s")
          $(".blue .hex").css("opacity": "0", "transition-delay": ".1s")
          $(".blue .rgb").css("opacity": "0", "transition-delay": "0s")
        when "red"
          #Divs
          $(".red").css("z-index": "2", "width":"64px", "height":"64px", "margin-top": "32px", "margin-left": "128px", "transition-delay": ".5s")
          $(".redSub").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".8s")
          $(".blue").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".9s")
          $(".blueSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".875s")
          $(".green").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".95s")
          $(".greenSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".925s")
          $(".purple").css("opacity": "1", "transform":"scale(1)", "transition-delay": "1s")
          $(".purpleSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".975s")
          #Texts
          $(".red .colorName").css("opacity": "0", "transition-delay": ".15s")
          $(".red .hex").css("opacity": "0", "transition-delay": ".1s")
          $(".red .rgb").css("opacity": "0", "transition-delay": "0s")
        when "green"
          #Divs
          $(".green").css("z-index": "2", "width":"64px", "height":"64px", "margin-top": "32px", "margin-left": "224px", "transition-delay": ".5s")
          $(".greenSub").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".8s")
          $(".blue").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".9s")
          $(".blueSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".875s")
          $(".red").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".95s")
          $(".redSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".925s")
          $(".purple").css("opacity": "1", "transform":"scale(1)", "transition-delay": "1s")
          $(".purpleSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".975s")
          #Texts
          $(".green .colorName").css("opacity": "0", "transition-delay": ".15s")
          $(".green .hex").css("opacity": "0", "transition-delay": ".1s")
          $(".green .rgb").css("opacity": "0", "transition-delay": "0s")
        when "purple"
          #Divs
          $(".purple").css("z-index": "2", "width":"64px", "height":"64px", "margin-top": "32px", "margin-left": "320px", "transition-delay": ".5s")
          $(".purpleSub").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".8s")
          $(".blue").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".9s")
          $(".blueSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".875s")
          $(".red").css("opacity": "1", "transform":"scale(1)", "transition-delay": ".95s")
          $(".redSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".925s")
          $(".green").css("opacity": "1", "transform":"scale(1)", "transition-delay": "1s")
          $(".greenSub").css("opacity": "0", "transform":"scale(1)", "transition-delay": ".975s")
          #Texts
          $(".purple .colorName").css("opacity": "0", "transition-delay": ".15s")
          $(".purple .hex").css("opacity": "0", "transition-delay": ".1s")
          $(".purple .rgb").css("opacity": "0", "transition-delay": "0s")

              
            
!
999px

Console