cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              .app
  //- The colors
  - const colors = ['transparent', '#f22613', '#e74c3c', '#f62459', '#663399', '#9a12b3', '#bf55ec', '#19b5fe', '#1e8bc3', '#1f3a93', '#89c4f4', '#03c9a9', '#26c281', '#16a085', '#2eec71', '#f2784b', '#f89406', '#f9bf3b']
  .duotone
  .chooser.chooser--lighten
    - for (let i = 0; i < colors.length; i++)
      label.lighten(title=`Lighten w/ ${colors[i]}`, class=`${colors[i] === 'transparent' ? 'clear' : ''}`, for=`lighten--${i}`, style=`--bg: ${colors[i]}; --angle: ${(360 / colors.length) * i}`)
      input(id=`lighten--${i}`, type='radio', value=`${colors[i]}`, name='lighten', style=`--angle: ${(360 / colors.length) * i}`)
  .chooser.chooser--darken
    - for (let i = 0; i < colors.length; i++)
      label.darken(title=`Darken w/ ${colors[i]}`, class=`${colors[i] === 'transparent' ? 'clear' : ''}`, for=`darken--${i}`, style=`--bg: ${colors[i]}; --angle: ${(360 / colors.length) * i}`)
      input(id=`darken--${i}`, type='radio', value=`${colors[i]}`, name='darken', style=`--angle: ${(360 / colors.length) * i}`)
  svg.indicator(preserveAspectRatio='xMinYMin', viewBox="0 0 24 24")
    path(d="M7,10L12,15L17,10H7Z")
            
          
!
            
              *
  box-sizing border-box

body
  background-color #111
  min-height 100vh
  overflow hidden
  overflow-y scroll
  display flex
  align-items center
  justify-content center

$duration = .25s
$border = 4px

.app
  background linear-gradient(45deg, #aaa, #111)
  width 100vw
  height 100vh
  min-height 550px
  position relative
.duotone
  background url('https://source.unsplash.com/220x220?bear,cat'), linear-gradient(45deg, #111, #aaa)
  background-size cover
  border-radius 100%
  height 220px
  left 50%
  overflow hidden
  position absolute
  top 50%
  transform translate(-50%, -50%)
  width 220px

  &:after
  &:before
    bottom 0
    content ''
    left 0
    position absolute
    right 0
    top 0
    transition background $duration $duration

  &:after
    background var(--lighten)
    mix-blend-mode lighten

  &:before
    background var(--darken)
    mix-blend-mode darken

.indicator
  height 40px
  left 50%
  position absolute
  top 50%
  transform translate(-50%, -260px)
  width 40px
  path
    fill #fff

input
  display none

.chooser
  position absolute
  top 50%
  left 50%
  transform rotate(calc(((var(--selectedRotation, 0) * -1) - 90) * 1deg))
  transition transform $duration ease

label
  background var(--bg)
  border $border solid #fafafa
  border-radius 100%
  cursor pointer
  height 44px
  left 50%
  position absolute
  top 50%
  transform translate(-50%, -50%) rotate(calc(var(--angle) * 1deg)) translateX(150px)
  width 44px

  &.darken
    transform translate(-50%, -50%) rotate(calc(var(--angle) * 1deg)) translateX(200px)

.clear
  border-color red
  border-width $border
  overflow hidden

  &:after
    background #f22613
    content ''
    height $border
    left 50%
    position absolute
    top 50%
    transform translate(-50%, -50%) rotate(45deg)
    width 100%


            
          
!
            
              const duotone = document.querySelector('.duotone')
const choosers = {
  darken: document.querySelector('.chooser--darken'),
  lighten: document.querySelector('.chooser--lighten'),
}
const updateTone = (e) => {
  const {
    name,
    value,
  } = e.target
  duotone.style.setProperty(`--${name}`, value)
  choosers[name].style.setProperty('--selectedRotation', e.target.style.getPropertyValue('--angle'))
}
document.body.addEventListener('input', updateTone)
document.body.addEventListener('change', updateTone)
            
          
!
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