Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

font-palette — selecting a font palette

The font-palette property selects a font’s color palette. It is inherited and has the initial value normal.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

font-palette: normal | light | dark | <palette-identifier> | <palette-mix()>;

font-palette controls a palette-capable font’s palette; it does not recolor arbitrary text. With normal, the browser may use the font’s default palette or choose a different palette based on color-scheme. light and dark select the first palette marked suitable for a light or dark background; without suitable metadata, they behave as normal.

An identifier starting with -- references @font-palette-values; without a matching rule, it behaves as normal. palette-mix() interpolates corresponding palette colors. Draft specification syntax does not guarantee browser support. The example checks inheritance without an external font, not changes to glyph appearance.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>font-palette inheritance</title>
<style>
  .parent { font-palette: dark; }
  .reset { font-palette: normal; }
</style>
<div class="parent">
  <span id="inherited">Inherited</span>
  <span id="reset" class="reset">Reset</span>
</div>
<pre id="result"></pre>
<script>
  const inherited = getComputedStyle(document.getElementById('inherited')).fontPalette;
  const reset = getComputedStyle(document.getElementById('reset')).fontPalette;
  document.getElementById('result').textContent =
    `inherited: ${inherited}\nreset: ${reset}`;
</script>
</html>

Result

inherited: dark
reset: normal

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources