colour
In a scanner's red light the bars and the background don't contrast enough, or the code is light on dark.
| Levels | fail; check for low but passing contrast, a reversed 2D code, and ink hints |
| Applies to | every symbology |
| Needs a print size | no |
What it means
Retail scanners light the code with red light, about 660 nm, and see only how much of it each colour reflects. Red, orange, yellow and pink bars reflect it like white paper and disappear. Blue, green, brown and black backgrounds absorb it and look as dark as the bars. The report names the colour and the reflectance it estimated.
Why scanners care
A scanner needs dark bars on a light background as it sees them, not as the eye does. Without that difference it finds no edges.
How to fix it
- Print the bars in black, or a dark blue, dark green or dark brown.
- Put the code on white or a pale colour. A strong red or orange background reads at a till and looks mid-grey to a phone camera, so it gets a
checkon a barcode and afailon a 2D code. - For a linear barcode, never reverse it (light bars on dark).
- On clear film or metallised board, print solid opaque white under the code and its quiet zones.
Thresholds
Reflectance is estimated from the colours in the artwork: the red channel of sRGB, linearised (src/rules/colour.ts:17).
| Condition | Level | In the code |
|---|---|---|
| Linear code, light bars on dark | fail | src/rules/check.ts |
| 2D code, light modules on dark | check | src/rules/check.ts |
| Bars reflect more than half of what the background reflects | fail | src/rules/colour.ts:96, :102 |
| Background reflects under 35% | fail | src/rules/colour.ts:97 |
| Contrast (background minus bars) under 40% | fail | src/rules/colour.ts:104 |
| Contrast 40–55% | check | src/rules/colour.ts:106 |
| Saturated red or orange background | check for linear, fail for 2D (phone cameras see it mid-grey) | src/rules/colour.ts:110 |
| A metallic spot ink in the file and a grey or gold colour at the code | check | src/rules/colour.ts:117 |
| A white spot ink in the file and a pure white background | check | src/rules/colour.ts:123 |
Limits
- The estimate comes from screen colours. A spot ink's real reflectance at 660 nm, the substrate, varnish and foil are not in the file. A verifier measures them on the print.
- Metallic and white-ink hints need the caller to pass the file's spot ink names.
gradeFileand the CLI don't, so those two hints appear only for library callers ofgradeCodes. - On a photo of a pack the colours are the camera's, and the check is skipped.
Spec
GS1 General Specifications, Release 26.0, §5.12.5.11.1 (Rmin at most half of Rmax; 40% as the grade 2 threshold for symbol contrast). The 55% threshold is ISO/IEC 15416 symbol contrast; clause not verified. Full table: spec map, colour.