A13

Warning

Accessibility

A13 — Colours without enough contrast

A theme's colour pairing falls below the WCAG AA contrast ratio.

What the compiler said

warning[A13]: text on a card or surface has a contrast ratio of 1.83:1, below the 4.5:1 WCAG AA minimum --> src/App.wf:2:1 | 2 | color-text: #BBBBBB | ^ = help: Darken --color-text or lighten --color-surface until they clear 4.5:1 = docs: https://webfluent.monzeromer.dev/errors/A13

The fix

Broken

wf

theme Faint { color-text: #BBBBBB color-background: #FFFFFF } page P(path: "/", title: "T", description: "D") { Heading("Contrast").h1 }

Fixed

wf

theme Faint { color-text: #333333 color-background: #FFFFFF } page P(path: "/", title: "T", description: "D") { Heading("Contrast").h1 }

Darken the text or lighten the background until the ratio clears 4.5:1 (3:1 for large text). A theme with a light tone names a dark label for it: color-primary: #FDE68A with color-on-primary: #1A1A19.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

Why this rule exists

The theme must be the one the build uses: the only one declared, or the one theme.name names in the config. A project wf init made names Day, so to try this example remove theme from its config.

It checks each pair a page draws: text on the background and on a surface, a tone used as a link or an icon on the background (3:1), and what is written on a tone — a primary button's or badge's label, a selected day — which is color-on-primary (and -secondary, -success, -danger, -warning, -info) on its tone.

lints may lower it:

"lints": { "A13": "off" } // wf-allow(A13)