generate().
RGB (Default)
RGB is the default color model. Pass red, green, and blue values on a 0–255 scale tocolor() and backgroundColor().
RGB with Alpha
Add a fourth argument to include an alpha (transparency) channel. The scale is 0–100, where0 is fully opaque and 100 is fully transparent.
CMYK
Switch to CMYK mode by callingcmyk() before color(). All four channel values use a 0–100 scale (percentage).
Gradients are only available in RGB mode. Calling
gradient() while in CMYK
mode is not supported.rgb().
Grayscale
Usegray() for a one-call shorthand that sets both foreground and (optionally) background to shades of gray. The scale is 0–100, where 0 is black and 100 is white.
- First argument — foreground shade (0 = black, 100 = white).
- Second argument — background shade. Defaults to
100(white) when omitted.
Gradients
Apply a two-color gradient to the QR code foreground withgradient(). Provide start and end colors as RGB arrays or hex strings, then choose a direction.
Gradient Types
Per-Eye Color Overrides
Override the color of any individual eye witheyeColor(). Each QR code has three positional eyes indexed 0, 1, and 2.
- Index —
0(top-left),1(top-right),2(bottom-left). - Inner color — color of the small inner marker square.
- Outer color — color of the outer frame. Omit this argument to apply the inner color to both parts.
Complete Color Example
Chain color options with style and format options to build a fully branded QR code.Styling
Set module shape, eye style, size, margin, and output format.
Image Merge
Embed a logo or image into the center of your QR code.