How color customization works
The application uses two primary color states to control the appearance of your QR codes:Foreground color
The color of the QR code pattern itself (the dark squares and modules)
Background color
The color behind the QR code pattern
Color state implementation
The color values are managed through React state with hex color format:#0f172a (slate-900, a dark blue-gray), and the default background is #ffffff (white).
Color picker interface
The application provides an intuitive color picker interface for both colors:Hex color format
All colors are stored and displayed in hexadecimal format (e.g.,#4f46e5). The hex value is shown alongside the color picker for easy copying and reference.
The color picker wrapper provides a unified interface:
- 60px wide color input
- Hex code display with monospace font
- Border styling that highlights on focus
- Smooth transitions between states
QR code generation with colors
Colors are applied to both the SVG and Canvas rendering:The background color defaults to white if set to transparent, ensuring QR codes remain scannable across different display contexts.
Best practices for scannable QR codes
Follow these guidelines for optimal scannability:Contrast requirements
High contrast is essential
High contrast is essential
Aim for a contrast ratio of at least 3:1 between foreground and background colors. Dark foreground on light background works best.
Avoid similar colors
Avoid similar colors
Don’t use colors that are too close in brightness or hue (e.g., light gray on white, or dark blue on black).
Test before production
Test before production
Always test your QR codes with a real scanner under different lighting conditions before printing or publishing.
Recommended color combinations
Classic
Foreground: Black (#000000)
Background: White (#ffffff)
Maximum contrast and reliability
Background: White (#ffffff)
Maximum contrast and reliability
Brand colors
Foreground: Dark brand color
Background: Light or white
Maintains identity while ensuring scannability
Background: Light or white
Maintains identity while ensuring scannability
Inverted
Foreground: White (#ffffff)
Background: Dark color
Works well on dark surfaces or designs
Background: Dark color
Works well on dark surfaces or designs
Accent colors
Foreground: Deep accent
Background: Light neutral
Adds visual interest with good contrast
Background: Light neutral
Adds visual interest with good contrast