Updated
Gamut Picker
ProCustomize
sRGB
Ghost0.22
Swatches
Installation
ProGamut Picker is a Pro component
Sign in to see the source, or install it with a license key. The live preview and props above are free to explore.
Install with a key
- Add the Pro registry to
components.json:components.json { "registries": { "@uibrik-pro": { "url": "https://uibrik.com/r/pro/{name}.json", "headers": { "Authorization": "Bearer ${UIBRIK_LICENSE}" } } } } - Put your key in
.env.localand add that file to.gitignore:.env.local UIBRIK_LICENSE=your-license-key - Install it:
Terminal npx shadcn@latest add @uibrik-pro/gamut-picker
Loading your installation…
Usage
import { GamutPicker } from "@/components/uibrik/gamut-picker/gamut-picker";const swatches = ["#2f7cf6", "#7c5cff", "#16a35a", "#e8890c", "#e5484d", "#0ea5a4", "#111111"];<GamutPicker defaultValue="oklch(0.68 0.16 252)" gamut="srgb" ghost={0.22} contrast intro swatches={swatches} label="Colour" onChange={(color) => {}} onChangeEnd={(color) => {}} // value="…"/>Where to use Gamut Picker
Design tools and theming
Seeing the real shape of the gamut shows why one hue can go vivid at a lightness where another can't.
Pairs with Swatch Picker
Accessible palettes
Contrast against white and black updates live, so a brand colour can be tuned to pass AA.
Pairs with Color Picker
Wide-gamut work
With gamut set to P3, the band of Display P3 colours past sRGB shows on the cut and can be picked.
Props
GamutPicker- defaultValue
- Type string
- "oklch(0.68 0.16 252)"
- Starting colour, as oklch(...) or hex.
- gamut
- Type "srgb" | "p3"
- "srgb"
- Widest gamut a pick may use. P3 shows its band on the cut.
- ghost
- Type number
- 0.22
- Opacity of the solid above the cut.
- contrast
- Type boolean
- true
- Contrast ratios against white and black.
- intro
- Type boolean
- true
- Swing the solid in and raise the cut on first view.
- swatches
- Type string[]
- ["#2f7cf6","#7c5cff","#16a35a","#e8890c","#e5484d","#0ea5a4","#111111"]
- Preset colours. Picking one glides the cut and thumb to it.
- value
- Type string
- –
- Colour as oklch(...) or hex (controlled). Pair with onChange.
- onChange
- Type (color: GamutColor) => void
- –
- Fires as the colour changes, with l, c, h, css, hex and gamut.
- onChangeEnd
- Type (color: GamutColor) => void
- –
- Fires once a drag ends or a value is committed.
- label
- Type string
- "Colour"
- Names the picker for screen readers.
- className
- Type string
- –
- Classes for the card.