A phone camera does not see your QR code in colour. It turns the picture into light parts and dark parts, then reads the pattern. So the only thing that matters is how different your two colours are in brightness.

This catches people out because colours can look very different to the eye and be almost the same in brightness. Red on green is the classic example. It looks bold. To a scanner it is grey on grey.

The scanner sees light and dark, not colour.

The number to check

Contrast is measured as a ratio. Black on white is 21:1, the highest you can get. Below about 3:1, scanning starts to fail. Below 2:1, it will not work at all.

CombinationContrastScans?
Black on white21:1Always
Navy on white15:1Yes
Mid grey on white3.9:1Usually
Red on green1.4:1No
Yellow on white1.1:1No

Two rules that keep you safe

Keep the background pale and the squares dark. Never the other way round. Some scanners assume dark-on-light and give up on an inverted code, even one with good contrast.

Leave the white border alone. That empty space around the edge tells the scanner where the code stops. Crop it off and a perfectly good code stops working.