IRONSOFTWAREHOME

How to Implement Custom QR Code Colors

Curtis Chau
Curtis Chau
Updated: August 2, 2026

QR codes have evolved from simple black-and-white patterns into powerful branding tools. In 2025, businesses recognize that a well-designed QR code can reinforce brand identity while maintaining full scannability. Customizing the foreground and background colors of your QR codes allows you to create visually appealing designs that stand out.

IronQR makes it simple to modify QR code colors using the QrStyleOptions class. You can change the foreground color (the dark modules), the background color, or both to match your brand guidelines.

In this how-to guide, we'll walk through different ways to customize QR code colors using IronQR in C#.

Quickstart: Customize QR Code Colors

Set foreground and background colors through QrStyleOptions and save the styled QR code.

  1. 1Install IronQR with NuGet Package Manager

    PM > Install-Package IronQR

  2. 2Copy and run this code snippet.

    var qrCode = QrWriter.Write("https://example.com");
    var style = new QrStyleOptions { Color = Color.DarkBlue, BackgroundColor = Color.LightYellow };
    qrCode.Save(style).SaveAs("colored-qr.png");
    C#
  3. 3Deploy to test on your live environment

    Start using IronQR in your project today with a free trial
    arrow pointer

Change Background Color

The background color of a QR code is the lighter area surrounding the dark modules. By default, this is white, but you can change it to any color that provides sufficient contrast with the foreground.

Setting a custom background color is useful when placing QR codes on colored surfaces or when you want to match your brand's color palette. Just ensure there's enough contrast for scanners to read the code reliably.

using IronQr;
using IronSoftware.Drawing;

// Create a QR code
QrCode qr = QrWriter.Write("https://ironsoftware.com/csharp/qr/");

// Set background color
QrStyleOptions styleOptions = new QrStyleOptions()
{
    BackgroundColor = Color.LightBlue
};

// Save QR code with custom background
AnyBitmap qrImage = qr.Save(styleOptions);
qrImage.SaveAs("qrBackgroundColor.png");
QR code with custom background color

Change Foreground Color

The foreground color represents the dark modules of the QR code - the actual data pattern that scanners read. While black is the standard choice, you can use any darker color that maintains good contrast against your background.

Changing the foreground color lets you incorporate your brand's primary color into the QR code design. Deep blues, dark greens, or rich burgundies work well as alternatives to black.

using IronQr;
using IronSoftware.Drawing;

// Create a QR code
QrCode qr = QrWriter.Write("https://ironsoftware.com/csharp/qr/");

// Set background color
QrStyleOptions styleOptions = new QrStyleOptions()
{
    Color = Color.PaleVioletRed
};

// Save QR code with custom background
AnyBitmap qrImage = qr.Save(styleOptions);
qrImage.SaveAs("qrBackgroundColor.png");
QR code with custom foreground color

Conclusion

Customizing QR code colors with IronQR opens up creative possibilities while keeping your codes fully functional:

  • Background Color: Use BackgroundColor to change the lighter area behind the QR pattern
  • Foreground Color: Use Color to modify the dark modules that encode your data
  • Combined Styling: Set both properties together for complete brand alignment

Remember to maintain adequate contrast between foreground and background colors to ensure reliable scanning across different devices and lighting conditions.

For more styling options including logos, margins, and dimensions, visit the IronQR documentation or explore additional code examples on GitHub.

Frequently Asked Questions

What is the purpose of customizing QR code colors with IronQR?

Customizing QR code colors with IronQR allows businesses to reinforce brand identity and create visually appealing designs that stand out while maintaining full scannability.

How can I set the foreground and background colors of a QR code using IronQR?

You can set the foreground and background colors of a QR code using the `QrStyleOptions` class in IronQR. Initialize `QrStyleOptions`, and set the `Color` and `BackgroundColor` properties to customize the QR code's appearance.

Why is it important to maintain contrast between the foreground and background colors of a QR code?

Maintaining adequate contrast between foreground and background colors is crucial to ensure reliable scanning across different devices and lighting conditions.

Can I use any color for the foreground and background of a QR code?

While you can choose any color for the foreground and background, it's important to select colors with sufficient contrast to ensure the QR code remains scannable.

How do I save a styled QR code with custom colors in IronQR?

After setting the desired colors with `QrStyleOptions`, use the `SaveAs` method to save the styled QR code with custom colors to a file.

What file formats can I use to save a QR code image in IronQR?

IronQR allows you to save QR code images in various formats. The example provided uses the format `.png`.

Can I embed the created QR code onto different colored surfaces?

Yes, by customizing the background color to match the surface where the QR code will be placed, you can enhance the integration while ensuring sufficient contrast for scanning.

What additional styling options are available for QR codes in IronQR?

Beyond color customization, IronQR offers styling options for adding logos, adjusting margins, and changing dimensions. You can find more details in the IronQR documentation.

Is IronQR compatible with C# for QR code color customization?

Yes, IronQR is compatible with C# and provides various options for customizing QR code colors directly within C# projects.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 74,386Version:2026.9just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronQR
nuget.org/packages/IronQR/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronQR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronQR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronQR.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required