Palette Swatches
Media · PaletteSwatches
A colour palette as swatches: each colour with its name and role, the HEX and OKLCH values (click to copy) and its WCAG contrast as text on a light and on a dark background, rated AAA, AA, AA large or fails.
colorsare data (#rrggbb), shown as they are: a brand's palette, not the kit's theme.lightanddarkset the backgrounds the contrast is measured against (default white and near black).compactshows small chips with name and values only;contrast={false}hides the contrast rows.- The maths is exported:
contrastRatio(a, b),wcagLevel(ratio),hexToOklch(hex)andformatOklch(hex).
- HarbourPrimaryOn light9.1 : 1AAAOn dark2.07 : 1Fails
- CremaAccentOn light2.66 : 1FailsOn dark7.09 : 1AAA
- FoamBackgroundOn light1.15 : 1FailsOn dark16.5 : 1AAA
- RoastTextOn light15.7 : 1AAAOn dark1.2 : 1Fails
- Mint leafSuccessOn light2.96 : 1FailsOn dark6.37 : 1AA
Props
PaletteSwatches
| Prop | Type | Notes |
|---|---|---|
surface? | Surface | `"glass"` for a translucent surface over a map, photo or video; `"solid"` opts out inside a glass provider. |
colors | PaletteColor[] | Required |
label? | string | Accessible name (default "Palette"). |
light? | string | Background for the light contrast (default white). |
dark? | string | Background for the dark contrast (default near black). |
contrast? | boolean | `false` hides the contrast rows. |
compact? | boolean | Small chips with name and values only. |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |