Customizing Color Fonts on the Web
WebKit (Safari 15.4+) supports the CSS `@font-palette-values` at-rule, which lets authors select a color font's predefined CPAL palettes by index and override individual palette colors, then apply them with the `font-palette` property. Browsers without support fall back to palette 0, which can be guarded with `@supports`. `font-palette: light`/`dark` pick palettes the font marks for light or dark backgrounds and pair naturally with `prefers-color-scheme`. Because palette rules are scoped per font family, one palette name can map to different palettes across fallback fonts. Foreground-color shapes in some fonts follow the `color` property instead, and authors should keep palette contrast high for legibility.
Related posts
- Add wide gamut P3 and alpha transparency to your color picker in HTML
WebKit mediumAdept`<input type="color">` now supports two new optional attributes, `alpha` and `colorspace`, added to the HTML standard with WHATWG and first shipped in Safari 18.4. With `colorspace="display-p3"` users can pick from the full P3 wide gamut, `limited-srgb` keeps the old 8-bit sRGB behavior, and `alpha` adds an opacity control. The `value` attribute now accepts any CSS color syntax, such as named colors, `oklab()` or `color(display-p3 ...)`, not just hex. Older browsers fall back to an sRGB picker without opacity, and to black for unsupported value syntax, so the attributes can be used today as progressive enhancement.
- How to have the browser pick a contrasting color in CSS
WebKit mediumAdeptCSS `contrast-color()` takes one color and returns black or white, whichever contrasts more, so a single variable like `--button-color` can drive both background and text, including hover states built with relative color syntax. The current spec uses the WCAG 2 contrast algorithm, which often picks the perceptually worse option on mid-tones (black on #317CFF scores 5.45:1 against 3.84:1 for white, though white is clearly more readable). APCA, a WCAG 3 candidate, scores contrast perceptually and accounts for font size and weight. The function only picks the better of two options, not a sufficient one, so it should be paired with careful palette design and `prefers-contrast` overrides. The CSSWG limited it to black/white so the algorithm can be swapped later without breaking sites.
- WebKit Features in Safari 17.5
WebKit mediumAdeptSafari 17.5 ships seven features and 22 bug fixes, led by CSS additions: text-wrap: balance (with the text-wrap-style longhand), the light-dark() color function, @starting-style for entry transitions, and supports() conditions on @import rules. WebKit balances an unlimited number of lines, versus 6 in Chromium and 10 in Firefox, but skips balancing around floats, initial letters, preserved tabs and soft hyphens. Unsupported text-wrap values fall back to auto, so they are safe to use as progressive enhancement. The release also adds AV1 in WebCodecs when a hardware decoder is available, two WebGL extensions, and fixes across accessibility, media, rendering, Web Push and WebRTC.
- WebKit Features in Safari 16.2
WebKit mediumAdeptSafari 16.2 focuses on cross-browser interoperability as part of Interop 2022, with Safari Technology Preview 159 passing 98.5% of the Interop tests. It completes support for `font-variant-alternates` values such as `styleset()`, `swash()` and `ornaments()` along with `@font-feature-values`, and adds `last baseline` alignment for Flexbox and Grid items. A long list of fixes covers CSS layout (flex sizing, scroll snap, text-decoration, aspect-ratio), rendering (transforms, canvas, tables), SharedWorker, and WebDriver on iOS.
- Introducing Adaptive Dark Mode
WebKit mediumAdeptSafari 27.3 beta adds Adaptive Dark Mode, which automatically darkens light websites that don't declare dark mode support via color-scheme. Inside WebKit, a luminosity-inverting color matrix preserves hue, text contrast targets WCAG 4.5:1, SVGs are recolored, simple black-and-white bitmap logos are detected via pixel histograms, and canvas, masks and mix-blend-mode are left alone or disabled. Sites can opt out with `color-scheme: light only`, improve results by using SVG, CSS colors and transparent images, or ship a custom dark mode using color-scheme, prefers-color-scheme and light-dark(). Websites cannot detect the transformation, because JavaScript sees the original authored colors, which avoids adding a fingerprinting signal.