Custom gray palettes should harmonize with the primary color and use a bell curve chroma pattern. This ensures light backgrounds look clean and dark backgrounds look sophisticated rather than muddy.
Chroma Distribution Pattern
Chroma should peak at mid-tones (400-600) and be very low at both extremes (50 and 950).
| Shade | Recommended Chroma | Purpose |
|---|
| 950 | 0.003 | Nearly pure dark, avoids muddiness |
| 900 | 0.005 | Very low chroma |
| 800 | 0.008 | Just a hint of tint |
| 500 | 0.020 | PEAK chroma (mid-tones) |
| 50 | 0.002 | Almost neutral, clean light background |
Implementation Example
Define the palette in the @theme block and reference it via var() in your theme selectors.
@theme theme-<name> inline {
/* Custom neutral palette */
--color-<name>-50: oklch(98% 0.002 <hue>);
--color-<name>-100: oklch(95.5% 0.004 <hue>);
/* ... full 50-950 scale ... */
--color-<name>-950: oklch(20.1% 0.003 <hue>);
}
[data-theme="theme-<name>"] {
--background: var(--color-<name>-50);
--background-1: var(--color-<name>-100);
}
[data-theme="theme-<name>"].dark {
--background: var(--color-<name>-950);
--background-1: var(--color-<name>-900);
}
@theme theme-<name> inline {
/* Custom neutral palette for this theme */
--color-<name>-50: oklch(98% 0.003 88);
--color-<name>-100: oklch(95.5% 0.005 88);
/* ... full 50-950 scale ... */
}
[data-theme="theme-<name>"] {
--background: var(--color-<name>-50);
--background-1: var(--color-<name>-100);
/* ... */
}
[data-theme="theme-<name>"].dark {
--background: var(--color-<name>-950);
--background-1: var(--color-<name>-900);
/* ... */
}