Color

Display color palettes with click-to-copy functionality

The Color component displays color swatches for documenting design systems, brand guidelines, or any color palette. Click any swatch to copy its value to the clipboard.

Compact Variant

The default layout displays colors in a responsive grid:

Primary
#3b82f6
Success
#22c55e
Warning
#f59e0b
Error
#ef4444
<Color>
  <ColorItem name="Primary" value="#3b82f6" />
  <ColorItem name="Success" value="#22c55e" />
  <ColorItem name="Warning" value="#f59e0b" />
  <ColorItem name="Error" value="#ef4444" />
</Color>

Table Variant

Group colors into labeled rows for organized palettes:

Brand Colors
Primary#3b82f6
Secondary#6366f1
Feedback Colors
Success#22c55e
Error#ef4444
<Color variant="table">
  <ColorRow title="Brand Colors">
    <ColorItem name="Primary" value="#3b82f6" />
    <ColorItem name="Secondary" value="#6366f1" />
  </ColorRow>
  <ColorRow title="Feedback Colors">
    <ColorItem name="Success" value="#22c55e" />
    <ColorItem name="Error" value="#ef4444" />
  </ColorRow>
</Color>

Theme-Aware Colors

Define different colors for light and dark modes by passing an object with light and dark properties:

Theme
Background
#ffffff
Theme
Foreground
#171717
Theme
Border
#e5e5e5
<Color>
  <ColorItem name="Background" value={{ light: "#ffffff", dark: "#0a0a0a" }} />
  <ColorItem name="Foreground" value={{ light: "#171717", dark: "#ededed" }} />
  <ColorItem name="Border" value={{ light: "#e5e5e5", dark: "#404040" }} />
</Color>

Toggle between light and dark mode to see the colors change.

Color Formats

The component supports standard CSS color formats:

Hex
#3b82f6
RGB
rgb(59, 130, 246)
RGBA
rgba(59, 130, 246, 0.8)
<Color>
  <ColorItem name="Hex" value="#3b82f6" />
  <ColorItem name="RGB" value="rgb(59, 130, 246)" />
  <ColorItem name="RGBA" value="rgba(59, 130, 246, 0.8)" />
</Color>

Properties

Color

stringdefault: compact

Layout style: compact (grid) or table (grouped rows).

node

ColorItem or ColorRow elements.

ColorRow

string

Label displayed above the row.

node

ColorItem elements.

ColorItem

string

Display name for the color.

string | object

Color value as CSS string, or { light: string, dark: string } for theme-aware colors.