Skip to content

Styling & Customization

The <color-input> component supports three theme modes:

  • auto (default) - Follows system preferences (prefers-color-scheme)
  • light - Always uses light theme
  • dark - Always uses dark theme

Use the theme attribute:

<color-input theme="auto"></color-input>
<color-input theme="light"></color-input>
<color-input theme="dark"></color-input>

Or set via JavaScript:

picker.theme = 'dark';
Value
oklch(65% 0.2 280)
Color Space
oklch
Gamut
Contrast Color
View Code
<color-input
value="oklch(65% 0.2 280)"
colorspace="oklch"
theme="auto"
></color-input>

Respects your system preference

The <color-input> element exposes several CSS parts for styling with the ::part() selector:

  • trigger - The button that opens the picker
  • chip - Color swatch inside the trigger button
  • label - Text label inside the trigger button
  • panel - Popover container
  • output - CSS color string display
  • gamut - Gamut badge (srgb/p3/rec2020/xyz)
  • controls - Container for channel sliders and inputs

Perfect for color palettes and compact color selection:

Customize parts based on the current theme:

/* Light theme customization */
color-input[theme="light"]::part(panel) {
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
/* Dark theme customization */
color-input[theme="dark"]::part(panel) {
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
border: 1px solid rgba(255, 255, 255, 0.1);
}
/* Auto adapts to system */
@media (prefers-color-scheme: dark) {
color-input[theme="auto"]::part(panel) {
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
}
PartDescription
triggerButton that opens the picker
chipColor swatch preview
labelText label (if any)
panelPopover container
outputCurrent color value display
gamutGamut badge
controlsSliders and inputs container