Colour QR Codes

Colour QR Codes

Author

admin

rainbow-qr-code2

One of the more common reasons why a QR code won't scan is because there isn’t enough contrast between the foreground and background colour used.

For a QR code to be scanned reliably the contrast difference between the foreground colour and the background colour used in the QR code image must be large enough for the camera in the scanning device to be able to identify the QR code pattern against its background.

If the contrast between the foreground and background colours isn’t large enough then the scanning device won’t able to “see” the QR code image against the background and hence won’t be able to scan it and decode it.

So, how much contrast is required? The answer is in two parts.

1. Tonal Contrast vs Hue Contrast

Many QR code scanning apps scan in black and white (grey-scale) and not in colour so the “contrast” value actually relates to the difference in the grey-scale tone (or brightness) of the two colours used and not the differences in their hues (colour).

To show the difference between Hue Contrast and Tonal Contrast here’s two QR code shown in colour and as their grey-scale equivalent – basically what we see versus what the scanning app "sees".

colour-to-grey

While there’s an obvious difference in foreground and background colour used in each QR code, the grey-scale tonal contrast in both cases is pretty much zero. Because it scans in black and white the scanning app won’t "see" the colours, just the greys, and hence not being able to discern the QR code image, the scan attempt will fail.

2. How Much Tonal Contrast Is Enough?

The amount of tonal contrast to ensure a reliable scan is going to depend on several factors:

  • Ambient light – not even a black and white QR code will scan in the dark.
  • Surface reflection – a shiny QR code image will reflect white. Not good if it’s on a white background.
  • Scan distance – the further away the QR code is, the smaller it looks to the camera and hence the more pronounced the distinction between foreground and background areas needs to be. This distinction is enhanced by a higher foreground to background colour contrast.
  • Camera quality – some cameras have a better tonal range response than others.

With a few variables at play it’s probably best to set a conservative tonal contrast level that’s going to work in the majority of situations and we reckon that safe contrast level is 40% or greater - ie; in terms of their relative brightness one of the colours should be at least 40% darker than the other one.

So, if your background colour has a grey-scale equivalent of 20% grey and your foreground colour has a grey-scale equivalent of 75% grey, then the tonal contrast is 70% - 20% = 50% tonal contrast. As this tonal contrast is greater than our recommended minimum of 40%, there’ll be no contrast-related scanning issues with this QR code.

Obviously a traditional black and white QR code will have the maximum possible scan reliability since its tonal contrast is 100% (white is 0% grey and black is 100% grey). As tonal contrast decreases from this 100% maximum so will the QR code's theoretical scan reliability, but selecting a foreground/background colour pair with a tonal contrast of greater than 40% (and ideally greater than 60%) will ensure that your QR code functions as expected under most conditions.

The image below shows the approximate grey-scale equivalent of various shades and hues across the colour spectrum. ie; the black-and-white version of every colour in a particular row is represented by the same shade of grey.

grey-colours

Tonal Contrast Calculator

Here’s a handy tool that will help you determine the tonal contrast between two colours so that you can choose a QR code foreground/background colour combination that can be used with confidence.

Check Color Contrast for your QR Codes

Reverse Image QR codes

While we're talking about QR code foreground and background colours and scan reliability I thought I'd briefly touch on another issue - reverse image QR codes, where the foreground is a lighter colour than the background.

While a reverse image QR code is supported under the ISO standard, it's quite surprising how many scanning apps can't read a reverse image QR code. Unfortunately this a scanning app thing and not a QR code thing so if you are intending to publish a reverse image QR code it might be a good idea to do a test scan on it first.

Here's the same QR code in normal and reverse image versions - see how your scanning app works with them.

reverse-image

0 Comment on ‘Colour QR Codes’

To top