Color fonts (such as COLRv1 and OpenType-SVG) bring multi-color typography, iconography, and stylized brand glyphs natively to the web without relying on bulky SVG images or Canvas renderers. However, historically, color font palettes were hardcoded into font binaries by typeface designers, preventing developers from adjusting font colours to match custom brand themes or dark mode interfaces. The modern CSS font-palette property and the @font-palette-values at-rule empower developers to select, customize, and override individual colour layers within color fonts. Safari Web Inspector provides specialized tools to inspect color font layers and test custom palette mappings interactively.
Understanding Color Fonts and font-palette
Standard web fonts contain vector glyph outlines rendered in a single solid colour determined by the CSS color property. In contrast, modern color fonts contain multiple internal color layers and predefined colour palettes embedded within the font table.
The font-palette property allows developers to switch between embedded palettes or apply custom palette overrides:
@font-palette-values --BrandPalette {
font-family: "Bungee Spice";
override-colors:
0 #1e3a8a,
1 #3b82f6,
2 #93c5fd;
}
.brand-heading {
font-family: "Bungee Spice", sans-serif;
font-palette: --BrandPalette;
}
Built-in keyword values include normal (default colorway), light (optimized for light backgrounds), and dark (optimized for dark backgrounds).
Enabling Developer Features in Safari
- Open Safari on macOS and open Settings (Cmd + ,).
- Switch to the Advanced tab.
- Ensure Show features for web developers is activated.
- Right-click on the color font heading on your webpage and select Inspect Element.
Inspecting Fonts in the Safari Font Panel
Safari Web Inspector includes a dedicated typography analysis pane:
- In Web Inspector, switch to the Elements tab.
- Select the element utilizing the color font in the DOM tree.
- In the right sidebar, locate and expand the Fonts panel (or inspect the Fonts section under the Computed tab).
- Review the rendered font details:
- Font Family: Confirms whether the custom web font was loaded successfully.
- Font Format: Indicates OpenType-COLR or OpenType-SVG support.
- Active Palette: Displays whether the font is utilizing a predefined system palette or a custom
--paletteidentifier.
Live-Testing Palette Overrides in the Styles Pane
To experiment with color palette swaps and check dark mode harmony:
- In the Styles panel, inspect the
font-paletterule. - Change the value to
darkorlightto evaluate the font designer’s built-in alternate palettes. - To define and test a custom palette live, insert a temporary
@font-palette-valuesblock into the inspector’s stylesheet or inline style rule. - Use Safari’s inline color picker swatches to modify individual palette indices (e.g., changing index
0from orange to deep navy). - Observe how the multi-layered vector glyph updates on the page canvas in real time.
Dynamic Dark Mode Palettes with light-dark()
Combine @font-palette-values with modern CSS functions to establish responsive color fonts that adjust automatically when users toggle system appearance:
@font-palette-values --DynamicPalette {
font-family: "Nabla";
override-colors:
0 light-dark(#2563eb, #60a5fa),
1 light-dark(#1d4ed8, #3b82f6);
}
h1 {
font-family: "Nabla";
font-palette: --DynamicPalette;
}
Use Safari’s Appearance Emulation button in the inspector toolbar to toggle between light and dark modes, verifying that each color font layer updates contrast automatically.
Best Practice Tips for Color Font Integration
- Subset Unused Glyphs: Color fonts carry larger file footprints than standard monochrome fonts. Use font subsetting tools (e.g.,
pyftsubset) to retain only the specific alphanumeric characters required. - Fallback Typography: Always supply a classic monochrome fallback font in the
font-familystack to ensure legible rendering on browsers that do not support COLRv1 color tables.