Skip to content
Twentyfirst UIHalo

Palette Swatches

Media · PaletteSwatches

View as Markdown

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.

  • colors are data (#rrggbb), shown as they are: a brand's palette, not the kit's theme.
  • light and dark set the backgrounds the contrast is measured against (default white and near black).
  • compact shows small chips with name and values only; contrast={false} hides the contrast rows.
  • The maths is exported: contrastRatio(a, b), wcagLevel(ratio), hexToOklch(hex) and formatOklch(hex).
  • HarbourPrimary
    On light9.1 : 1AAA
    On dark2.07 : 1Fails
  • CremaAccent
    On light2.66 : 1Fails
    On dark7.09 : 1AAA
  • FoamBackground
    On light1.15 : 1Fails
    On dark16.5 : 1AAA
  • RoastText
    On light15.7 : 1AAA
    On dark1.2 : 1Fails
  • Mint leafSuccess
    On light2.96 : 1Fails
    On dark6.37 : 1AA

Props

PaletteSwatches

PropTypeNotes
surface?Surface`"glass"` for a translucent surface over a map, photo or video; `"solid"` opts out inside a glass provider.
colorsPaletteColor[]Required
label?stringAccessible name (default "Palette").
light?stringBackground for the light contrast (default white).
dark?stringBackground for the dark contrast (default near black).
contrast?boolean`false` hides the contrast rows.
compact?booleanSmall chips with name and values only.
className?stringExtra class on the root element.
style?CSSPropertiesInline style on the root element.