Wide-Gamut Colors
Work with sRGB, Display P3, A98 RGB, Rec2020, ProPhoto, XYZ, and perceptual spaces like OKLCH and OKLab. The picker also detects which gamut contains the current color.
— <color-input value="#0bf8"></color-input>Wide-Gamut Colors
Work with sRGB, Display P3, A98 RGB, Rec2020, ProPhoto, XYZ, and perceptual spaces like OKLCH and OKLab. The picker also detects which gamut contains the current color.
Multiple Editing Modes
Edit the same color through text input, sliders, numeric fields, a colorspace select, and a 2D area picker without losing sync.
Gamut-Aware Area Picker
The 2D picker adapts to the active colorspace and can render gamut-aware boundaries for perceptual and wide-gamut workflows.
Customizable UI
Shadow DOM keeps the component self-contained while CSS parts expose the trigger, panel, input, controls, area, and readouts for styling.
<color-input> is more than a swatch and a few sliders. The current picker UI includes:
These pieces stay synchronized whether the value changes through the UI, attributes, or properties.
<script type="module"> import 'https://cdn.jsdelivr.net/gh/argyleink/css-color-component/dist/index.js'</script>
<color-input value="oklch(75% 30% 180)"></color-input>— The component chooses a different editing plane depending on the current colorspace:
srgb and hex use an OKHSV-style plane for practical RGB pickinghsl uses saturation × lightnessoklch, lch, and wide-gamut RGB-like spaces use a chroma × lightness planeoklab and lab use an a × b plane around the originhwb uses whiteness × blacknessFor spaces that benefit from it, the area picker can render gamut boundaries and stretch the interactive mapping so the useful region fills more of the canvas.
Use it when you want a custom element that: