Color, contrast and why scanners disagree with your eyes

A code can be almost any two colors, as long as a scanner can tell which is which. That turns out to be a question about brightness and wavelength rather than about color, and it is why some combinations that look bold to a designer are unreadable at a till.

Updated 8 September 2026

Scanners see brightness, not color

A camera-based decoder converts the image to grayscale before it does anything else, then picks a threshold and calls everything above it light and everything below it dark. Hue is discarded in the first step. What survives is luminance.

So the question to ask of any color pair is not whether they look different. It is whether they would still look different in a black-and-white photocopy. Two colors of similar brightness, a mid blue and a mid green say, are vivid to the eye and nearly identical to the decoder.

Dark on light, and the inversion question

The specification assumes dark modules on a light background. Light modules on a dark background, sometimes called an inverted or reversed code, is a real thing and many modern decoders handle it happily, including the camera apps on current phones.

Many is not all. Older handsets, some dedicated scanner apps, and a good deal of fixed industrial equipment will simply not see an inverted code. Since you cannot know what the reader is holding, inversion is a choice that trades a slice of your audience for a design effect. On a poster where the audience is broad and you get one attempt, it is rarely worth it.

For one-dimensional barcodes there is no debate: bars must be dark on a light background, and inversion does not work.

The red problem, and why it only affects some scanners

Traditional barcode scanners are not cameras. They shine red light at the label and measure what comes back. Red ink reflects red light, so under that illumination red bars are bright. They look, to the scanner, like more background.

A red barcode on a white box is therefore invisible to a checkout laser while looking perfectly clear to you and scanning fine on your phone, which is a camera and does not care. This is a genuinely common and expensive packaging mistake, because it passes every test that happens in the design studio.

The rule that falls out of it is asymmetric. Warm colors, red, orange, yellow and light browns, are poor choices for the bars and perfectly good as the background. Cool dark colors, black, dark blue, dark green, work as bars. Black bars on a yellow or white background is the safest pairing there is, which is why so much packaging looks like that.

BarsBackgroundVerdict
BlackWhite or yellowSafest
Dark blue or dark greenWhite or light warm colorUsually fine, verify it
Red or orangeAnyFails under red illumination
Any dark colorDark backgroundInsufficient contrast
Metallic or foilAnyUnpredictable; reflection swamps the reading
Pairings for one-dimensional barcodes read by laser scanners

How far you can push brand colors

On a QR code read by phones, you have real freedom, provided the dark side stays genuinely dark. A saturated brand color at full strength against white is usually comfortable. The same color tinted to 60% is often not, because tinting is exactly the operation that raises luminance.

  • Keep the light side close to white. Contrast lost on the background cannot be won back by darkening the modules.
  • Gradients are fine as long as the whole range stays dark. A gradient that fades toward the light end fails in the region where it does, and it fails silently, because the rest of the code still looks correct.
  • Avoid photographic or textured backgrounds behind a code. Local contrast changes across the symbol defeat the single threshold the decoder picks.
  • Transparent backgrounds are a trap in print. The code inherits whatever it is placed on, which may be decided later by somebody who has not read any of this. Export with an explicit light background unless you control the destination.

Measuring instead of guessing

Designers usually have a contrast-ratio tool to hand from accessibility work. It is not the metric the barcode trade uses, but it is a reasonable proxy here, because both are asking how far apart two colors are in brightness. If a pair would fail as body text on a background, treat it as failing for a code.

The trade metric for printed barcodes is a print contrast measurement taken with a verifier under standard illumination, and it produces a grade rather than a pass or fail. If you are printing retail packaging at volume, that verification is worth buying, because the failure mode it catches is one that only appears at the till.