The @font-palette-values
CSS at-rule allows you to customize the default values of font-palette created by the font-maker.
The @font-palette-values
CSS at-rule allows you to customize the default values of font-palette created by the font-maker.
@font-palette-values --identifier { font-family: Bixa; } .my-class { font-palette: --identifier; }
The <dashed-ident> is a user defined identifier, that while it looks like a CSS custom property behaves in a different way and is not wrapped in a CSS var() function.
Specifies the name of the font family that this palette can be applied to.
Specifies the name or index of the base-palette, created by the font-maker, to use.
Specifies the colors in the base palette to override.
@font-palette-values =
@font-palette-values <dashed-ident> { <declaration-list> }
This example shows how you can change some or all of the colors in a color font.
<p>default colors</p> <p class="alternate">alternate colors</p>
@import url(https://fonts.googleapis.com/css2?family=Bungee+Spice); p { font-family: "Bungee Spice"; font-size: 2rem; } @font-palette-values --Alternate { font-family: "Bungee Spice"; override-colors: 0 #00ffbb, 1 #007744; } .alternate { font-palette: --Alternate; }
When overriding colors of the normal or base-palette at index 0 you do not need to declare which base-palette to use. This should only be done when overriding a different base-palette. If you are overriding all the colors then there is also no need to specify the base-palette to use.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
@font-palette-values |
101 | 101 | 107 | No | 87 | 15.4 | 101 | 101 | 107 | 70 | 15.4 | 19.0 |
base-palette |
101 | 101 | 107 | No | 87 | 15.4 | 101 | 101 | 107 | 70 | 15.4 | 19.0 |
font-family |
101 | 101 | 107 | No | 87 | 15.4 | 101 | 101 | 107 | 70 | 15.4 | 19.0 |
override-colors |
101 | 101 | 107 | No | 87 | 15.4 | 101 | 101 | 107 | 70 | 15.4 | 19.0 |
font-palette
propertyfont-family
descriptorbase-palette
descriptoroverride-colors
descriptorCSSFontPaletteValuesRule
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/@font-palette-values