Skip to content

colour ​

In a scanner's red light the bars and the background don't contrast enough, or the code is light on dark.

Levelsfail; check for low but passing contrast, a reversed 2D code, and ink hints
Applies toevery symbology
Needs a print sizeno

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 check on a barcode and a fail on 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).

ConditionLevelIn the code
Linear code, light bars on darkfailsrc/rules/check.ts
2D code, light modules on darkchecksrc/rules/check.ts
Bars reflect more than half of what the background reflectsfailsrc/rules/colour.ts:96, :102
Background reflects under 35%failsrc/rules/colour.ts:97
Contrast (background minus bars) under 40%failsrc/rules/colour.ts:104
Contrast 40–55%checksrc/rules/colour.ts:106
Saturated red or orange backgroundcheck 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 codechecksrc/rules/colour.ts:117
A white spot ink in the file and a pure white backgroundchecksrc/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. gradeFile and the CLI don't, so those two hints appear only for library callers of gradeCodes.
  • 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.

MIT licensed. It predicts from the artwork; it is not a verifier.