CSS Reference ยท Typography
The font-palette property
Reference for the CSS font-palette property: choose a color palette (normal, light, dark or custom) for color fonts, with @font-palette-values and notes on support.
Most fonts are single-color: the glyphs take the text color. Color fonts contain glyphs drawn with several colors, and many of them include one or more built-in palettes, such as a light-background set and a dark-background set.
The font-palette property selects which palette is used. You can pick the font's defaults, ask for a palette designed for light or dark backgrounds, or point at a custom palette that you define with @font-palette-values.
.logo { font-family: "My Color Font"; font-palette: dark; }
Try it
Do not expect different colors here. Most emoji fonts have a single palette, or are bitmap fonts that cannot be recolored, so every row looks the same. The example shows the syntax; a color font designed with several palettes is needed to see an effect.
Syntax
font-palette: normal | light | dark | <dashed-ident>;
| Initial value | normal |
| Applies to | All elements and text |
| Inherited | Yes |
| Animatable | Discrete (switches at once) |
| Computed value | As specified |
Values
| Value | Description |
|---|---|
normal |
The font's default palette. |
light |
The first palette marked as suitable for light backgrounds, if the font has one. |
dark |
The first palette marked as suitable for dark backgrounds, if the font has one. |
<dashed-ident> |
The name of a custom palette defined in an @font-palette-values rule, such as --brand. |
Usage notes
- Needs a color font. Fonts must use the color glyph formats that carry palette data (such as COLR/CPAL). Single-color fonts and bitmap emoji ignore the property.
- Custom palettes. In
@font-palette-values,base-paletteselects a starting palette andoverride-colorsreplaces individual entries by index. The at-rule'sfont-familymust name the same family. - Light and dark mode. Combine
font-palette: lightanddarkwith aprefers-color-schememedia query so a color logo font fits either theme. - Fallbacks. If the palette name does not exist, or the font has no palettes, the text uses the default palette.
- Not a text color. Color fonts draw with their own colors.
colorstill applies to glyph parts that the font marks as "text color".
Browser support
Support is newer and less complete than for ordinary font properties, and it also depends on the color font format, so check a compatibility table before relying on it.