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.
| Combination | Contrast | Scans? |
|---|---|---|
| Black on white | 21:1 | Always |
| Navy on white | 15:1 | Yes |
| Mid grey on white | 3.9:1 | Usually |
| Red on green | 1.4:1 | No |
| Yellow on white | 1.1:1 | No |
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.