Pen Settings



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


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.


Auto Save

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.


  <h2>Gradient Hue Interpolation</h2>
  <p>Gradient is just an angle rotation in HSL, but with Color 4 you can tell it which way around to go.</p>

<main id="app"></main>


                @import "" layer(design.system);
@import "" layer(;

@layer demo {
  main {
    display: grid;
    gap: var(--size-5);
    inline-size: clamp(90%, calc(var(--size-content-3) * 1.5), 90vw);
  .ramp {
    display: flex;
    block-size: 5vh;
  .swatch {
    flex: 1;
  header {
    text-align: center;
  header > p {
    max-inline-size: var(--size-content-2);
    margin-inline: auto;

@layer {
  body {
    display: grid;
    place-content: center;
    padding: var(--size-5);
    gap: var(--size-5);
    justify-items: center;


                import Color from ''

function updateUI() {
  const color1 = new Color('hsl(180deg 100% 75%)')
  const color2 = new Color('hsl(240deg 100% 75%)')
  const interpolations = ['shorter', 'longer', 'increasing', 'decreasing']
  let mix = null
  let rows = ''

  for (let strategy of interpolations) {
    mix = color1.steps(color2, {
      hue: strategy,
      space: 'hsl',
      steps: 200,
      outputSpace: 'srgb',

    rows += `
        <div class="ramp">
          ${mix.reduce((acc, item) => {
            return acc += `<div class="swatch" style="background: ${item}"></div>`
          }, '')}
  app.innerHTML = rows