@font-palette-values
Example
.title {
font-family: "Bungee Spice";
color: crimson;
}@font-palette-values --warm {
font-family: "Bungee Spice";
override-colors: 0 crimson, 1 gold;
}
.title {
font-family: "Bungee Spice";
font-palette: --warm;
}color does not recolor a color font; a custom palette overrides its built-in colors by index.
Common mistakes
- Applying a palette to a regular font, which has no color layers.
- Using a palette name without
--, which is invalid.
Key points
- The rule names
font-familyexactly as declared in@font-face. - The palette name starts with
--and is applied throughfont-palette.
Interview questions
What does base-palette do?
base-palette do?It picks one of the palettes built into the font as the starting point, by index, before override-colors applies.
Can I switch font palettes for dark mode?
Yes, set a different font-palette inside a prefers-color-scheme: dark media query.