DEV Community

Cover image for How to Create Colored QR Codes with Python
Free Python Code
Free Python Code

Posted on

How to Create Colored QR Codes with Python

Hi πŸ™‚πŸ–

In this tutorial, we will show you how to create colored QR codes with Python. These codes can be used to create QR tags that display different colors depending on the device that scans them.

QR codes are a great way to share static information with users of mobile devices. By creating colorful QR codes, you can give your users a more dynamic experience when scanning your tags. In this tutorial, we will teach you how to create these codes quickly and easily with Python.

In this post, I will share with you How to Create Colored QR Codes with Python and module called segno.

To create colored QRcode you need to install segno from here :

  • pip install segno

Now you need some colors you can select the color you want from this link : https://flatuicolors.com/

Now we are ready to use segno to generate colored QRcode

import segno

qr = segno.make_qr('This is test')
qr.save('out.png', scale = 10, dark = '#81ecec', light = '#2d3436')
Enter fullscreen mode Exit fullscreen mode

result

Image description

The argument dark for the QRcode the light argument for the background

You can also make colore for QR data


import segno

qr = segno.make_qr('This is test')
qr.save('out.png', scale = 10, dark = '#81ecec', data_dark = 'blue', light = '#2d3436')
Enter fullscreen mode Exit fullscreen mode

result

Image description

Now we're done πŸ€—

Don't forget to like and follow πŸ™‚

Support me on PayPal πŸ€—
https://www.paypal.com/paypalme/amr396

Top comments (0)