Crossette

← All articles

Why a chart symbol stays readable on any colour: the WCAG contrast ratio

Updated:

In the "Symbols on colour" view, every square of the chart is filled with its thread colour and a symbol sits on top. Threads range from white to almost black, and the symbol has to be readable on each. A dark symbol on navy or a white one on pale yellow tires the eyes, and look-alike signs get mixed up. So the symbol colour isn't picked by eye but by a formula.

Brightness as the eye sees it

The eye responds differently to red, green and blue: green looks brightest, blue darkest. So the brightness of a colour isn't the average of the three channels. The W3C accessibility guidelines, WCAG 2.2, call it relative luminance (definition) and compute it like this:

  1. Each sRGB channel (0 to 255) is divided by 255 and converted to a linear scale: screen values follow a curve, not a straight line.
  2. The channels are added with weights: L = 0.2126 · R + 0.7152 · G + 0.0722 · B.

The result runs from 0 (black) to 1 (white). Green carries more than half the weight, which is why a light green thread is lighter than a red one of the same "strength".

The contrast ratio

Two colours are compared by their contrast ratio (definition):

(L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter colour and L2 of the darker one.

The ratio runs from 1:1 (the same colour) to 21:1 (black on white).

Which thresholds count as enough

A chart symbol is somewhere between a letter and an icon: it's small and has to be told apart from its neighbours. So for symbols it makes sense to aim at the text threshold, not the icon one.

Dark or white: how to choose

The simple rule "dark on light, white on dark" with one brightness cut-off fails on mid tones: a white symbol can fall below 4.5:1 there even though a dark one would read better. It's more reliable to compute both options and take the one with the higher ratio.

How Crossette does it

  • Symbol colour. A symbol is drawn in one of two inks, near-black or white. For each square the app computes the WCAG contrast ratio of both against the square's colour and takes the higher one.
  • The "Symbol contrast" setting on the chart screen, in "View settings":
    • "Normal": the symbol as it is;
    • "High": a thin halo of the other ink under the symbol, so the sign stands apart from the fill;
    • "Maximum": a wider halo and a heavier symbol: "Heavier symbols with an outline, for small and look-alike signs."
  • The system setting. While Increase Contrast is on in iOS, symbols are at least "High".

If symbols get mixed up, try "Maximum" and check which sign stands for what in the key. For how the key and symbols work, see "How to read a cross stitch chart", and for stitching in the evening, see "Stitching in the evening: light, screen and dark mode to rest your eyes".

About the author

This article was written by the Crossette team. We're building Crossette, a cross stitch tracker for iPhone and iPad. It's in development; to join the beta, see the Beta page.