Skip to content
animorio
IT
All components

Brand color picker

Pickers, HoverGSAP, CSS onlyMediumCompressed weight: Demo 8.1 KBGSAP 28 KBFreeDownload the zip

The brand color panel of an editor, in the clean style of real product interface pieces: a saturation and brightness square to drag, the hue bar, six saved swatches and the hex field. The handle grows when you grab it, the hex digits roll one by one, the sample headline and button change color live and the contrast label says whether text stays readable (AA, AAA). A swatch sends the handle flying to its place on a spring; Copy copies the color and draws a check.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Brand color picker" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>The brand color picker</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage" data-stage>
    <!-- the brand color panel of a design tool: drag the saturation and brightness square, slide the hue,
         pick a saved swatch, and the hex rolls digit by digit while the preview and the contrast follow -->
    <section class="panel" data-panel aria-label="Brand color">
      <header class="panel__head">
        <div>
          <p class="panel__title">Brand color</p>
          <p class="panel__sub">Tintwell <span>/ Design tokens</span></p>
        </div>
        <p class="badge" data-badge aria-live="polite">
          <span class="badge__roll" data-badge-roll><span data-badge-text>AA</span></span>
          <span class="badge__ratio" data-ratio>4.6:1</span>
        </p>
      </header>

      <div class="sv" data-sv role="slider" tabindex="0" aria-label="Saturation and brightness" aria-valuetext="">
        <div class="sv__white"></div>
        <div class="sv__black"></div>
        <div class="thumb thumb--sv" data-sv-thumb><span class="thumb__ring" data-sv-ring></span></div>
      </div>

      <div class="hue" data-hue role="slider" tabindex="0" aria-label="Hue" aria-valuemin="0" aria-valuemax="360">
        <div class="thumb thumb--hue" data-hue-thumb><span class="thumb__ring" data-hue-ring></span></div>
      </div>

      <div class="swatches" data-swatches role="listbox" aria-label="Saved colors"></div>

      <div class="hexrow">
        <div class="hex" data-hex>
          <span class="hex__hash">#</span>
          <span class="hex__digits" data-digits></span>
        </div>
        <button class="copy" type="button" data-copy aria-label="Copy hex">
          <svg viewBox="0 0 24 24" aria-hidden="true">
            <g data-copy-sheets>
              <rect x="8.5" y="8.5" width="11" height="11" rx="2.4"></rect>
              <path d="M15.5 5.6V5.4c0-1.3-1-2.4-2.4-2.4H6.4C5 3 4 4 4 5.4v6.7c0 1.3 1 2.4 2.4 2.4h.2"></path>
            </g>
            <path class="copy__check" data-check d="M5.5 12.6 9.8 16.8 18.6 7.6"></path>
          </svg>
          <span class="copy__roll"><span class="copy__label" data-copy-label>Copy</span><span class="copy__label copy__label--done" data-copy-done>Copied</span></span>
        </button>
      </div>

      <div class="preview" aria-label="Preview">
        <p class="preview__title" data-preview-title>Ship it brighter</p>
        <span class="preview__btn" data-preview-btn>Get started</span>
      </div>
    </section>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.2 19.2 11l-6.3 1.6-3.3 5.9Z"></path></svg>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

24 values to change

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Brand color picker” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On a very light grey sits the white Brand color panel of Tintwell, an invented design tool: at the top the title and the contrast label (for example AA 4.6:1), below it the saturation and brightness square with its white handle, the rainbow hue bar with its knob, six saved swatches, the hex field with the black Copy button and at the bottom the preview: the headline “Ship it brighter” and the “Get started” button in the chosen color. Grab the handle and drag: it grows, its shadow opens, the hex digits roll up or down depending on whether they rise or fall, the headline and the button change color live and the contrast label rolls between Low, AA Large, AA and AAA; the button text turns black when the color gets too light. The hue bar does the same with its knob. A click on a swatch lights its ring and sends the handle flying to its place, turning the hue the short way round, with a small overshoot and settle. Copy squeezes, its two sheets give way to a drawn check and the label rolls to Copied. The drawn pointer does everything by itself and starts again; a real gesture stops it for eight seconds.

How it works

One state, in HSV

The color lives in an object with hue, saturation and value: the square writes saturation and value, the bar writes hue, and a render function works out red, green and blue from there, the hex, the position of both knobs, the square’s background and the preview’s CSS variables.

Rolling digits

Each digit is a 1ch box holding the current character; when it changes the new one comes in from below (or from above if the value falls) and the old one leaves the other way. While dragging the digits update at most every 70 milliseconds: they roll, they don’t buzz.

Flying to a swatch

Clicking a swatch doesn’t jump: a back.out tween takes saturation and value from where they are to the swatch’s with a small overshoot, and the hue turns the short way round the circle (never more than 180 degrees).

Real contrast

The color’s relative luminance (the WCAG formula) gives its ratio against white and against black: the button takes whichever text reads better and the label says AAA from 7, AA from 4.5, AA Large from 3, Low below.

Values to change

NameFileDefaultWhat it changes
STARTscript.js#5b5bd6The brand color it starts from.
SWATCHESscript.js#5b5bd6,#e5484d,#f76b15,#30a46c,#0090ff,#111113The saved swatches, comma separated.
ROLLscript.js0.22How many seconds a hex digit takes to roll.
FLYscript.js0.7How many seconds the handle takes to fly to a swatch.
GRABscript.js1.35How much the handle grows when you grab it.
PAUSEscript.js0.8How many seconds the autopilot waits between gestures.

Try them in the Playground

When to use it

For the brand settings of a design tool, a site builder or a design system, an app’s theme customization, anywhere a color is picked and you need to know right away whether text stays readable.

On phones

The panel takes the width of the box, the square gets shorter with the screen height (24vh, between 84 and 168 pixels) and the knobs drag with a finger: touch does what the mouse does.

With reduced motion

No flights and no rolling digits: the color changes at once, the swatch ring and the Copy check appear without a spring and the drawn pointer stays hidden.

Pitfalls

  • While dragging the hex changes every frame: if every digit rolled each time it would buzz; the digits update at most every 70 milliseconds and the last value is still written on the next tick.
  • A hue between 350 and 10 degrees must turn the short way: without the 360 correction the handle would sweep the whole rainbow.
  • The square and bar sizes are read again on resize: the preview box changes height while you watch, and pixel positions would end up out of place.
  • navigator.clipboard can be missing or refuse (page in an iframe): the call sits in a try and the Copy check shows anyway.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 8.1 KB; the libraries: GSAP 28 KB.

Testing

Tested on 26 October 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All components