Colorful QR Codes

Almost all serializers support custom settings for the color of the dark and light modules of a (Micro) QR Code.

The color values can be provided as tuple (R, G, B), as web color name (like ‘red’) or as hexadecimal #RRGGBB value (i.e. ‘#085A75’). If alpha transparency is supported (i.e. PNG and SVG), hexadecimal values like #RRGGBBAA are accepted.

The value None is accepted by many serialization formats and indicates transparency, i.e. light=None indicates that all light modules should be transparent.

In almost all cases the color values are automatically converted into a meaningful value of the specific output format.

The keywords are optional, if not provided, all serializers use reasonable default values (dark modules are rendered in black, light modules in white).

Note

Providing an alpha channel to a serializer which does not accept an alpha channel results usually into an error.

The SVG, PNG, and PPM serializers support more than two colors, every module type may have its own color.

>>> import segno
>>> # Force version 7 since smaller versions don't carry any version information (see below)
>>> qr = segno.make('Yellow Submarine', version=7, error='h')
>>> qr.save('yellow-submarine.png', scale=4, dark='darkred', data_dark='darkorange',
            data_light='yellow')
Colorful 7-H QR Code encoding "Yellow Submarine"
>>> import segno
>>> mqr = segno.make('Rain', error='q')
>>> mqr.save('rain.png', scale=4, dark='darkblue', data_dark='steelblue')
Colorful M4-Q QR Code encoding "RAIN"

Module names

The following examples show the results of all supported module types. The unaffected modules are rendered as grey or white modules, the red modules show the result of the keyword.

The keywords “dark” and “light” (at the command line --dark and --light) are supported by almost all serialization formats.

dark / --dark

Sets the (default) color of dark modules.

Picture showing the dark modules Picture showing the dark modules of a Micro QR Code

light / --light

Sets the (default) color of light modules.

Picture showing the light modules Picture showing the light modules of a Micro QR Code

alignment_dark / --align-dark

Sets the color of the dark alignment pattern modules.

Micro QR Codes don’t have alignment patterns.

Picture showing the dark alignment modules Picture showing the dark alignment modules of a Micro QR Code (None)

alignment_light / --align-light

Sets the color of the light alignment pattern modules.

Micro QR Codes don’t have alignment patterns.

Picture showing the light alignment modules Picture showing the light alignment modules of a Micro QR Code (None)

dark_module / --dark-module

Sets the color of the dark module.

Micro QR Codes don’t have a dark module.

Picture showing the dark modules Picture showing the dark modules of a Micro QR Code (None)

data_dark / --data-dark

Sets the color of the dark data modules.

Picture showing the dark data modules Picture showing the dark data modules of a Micro QR Code

data_light / --data-light

Sets the color of the light data modules.

Picture showing the light modules Picture showing the light modules of a Micro QR Code

finder_dark / --finder-dark

Sets the color of the dark modules of the finder pattern.

Picture showing the dark finder modules Picture showing the dark finder modules of a Micro QR Code

finder_light / --finder-light

Sets the color of the light modules of the finder pattern.

Picture showing the light finder modules Picture showing the light finder modules of a Micro QR Code

format_dark / --format-dark

Sets the color of the dark modules of the format information.

Picture showing the dark format information modules Picture showing the dark format information modules of a Micro QR Code (None)

format_light / --format-light

Sets the color of the light modules of the format information.

Picture showing the light format information modules Picture showing the light format information modules of a Micro QR Code (None)

quiet_zone / --quiet-zone

Sets the color of the quiet zone.

Picture showing the quiet zone Picture showing the quiet zone of a Micro QR Code

separator / --separator

Sets the color of the separator.

Picture showing the separator Picture showing the separator of a Micro QR Code

timing_dark / --timing-dark

Sets the color of the dark modules of the timing pattern.

Picture showing the dark timing pattern modules Picture showing the dark timing pattern modules of a Micro QR Code

timing_light / --timing-light

Sets the color of the light modules of the timing pattern.

Picture showing the light timing pattern modules Picture showing the light timing pattern modules of a Micro QR Code

version_dark / --version-dark

Sets the color of the dark modules of the version information.

Micro QR Codes and QR Codes lesser than version 7 don’t carry any version information.

Picture showing the dark version modules Picture showing the dark version modules of a Micro QR Code (None)

version_light / --version-light

Sets the color of the light modules of the version information.

Micro QR Codes and QR Codes lesser than version 7 don’t carry any version information.

Picture showing the light version modules Picture showing the light version modules of a Micro QR Code (None)