How to Implement Custom QR Code Colors

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. Install IronQR with NuGet Package Manager

    PM > Install-Package IronQR
  2. Copy 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");
  3. Deploy 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.

:path=/static-assets/qr/content-code-examples/how-to/implement-custom-qr-code-background.cs
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");
Imports IronQr
Imports IronSoftware.Drawing

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

' Set background color
Dim styleOptions As New QrStyleOptions() With {
    .BackgroundColor = Color.LightBlue
}

' Save QR code with custom background
Dim qrImage As AnyBitmap = qr.Save(styleOptions)
qrImage.SaveAs("qrBackgroundColor.png")
$vbLabelText   $csharpLabel
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.

:path=/static-assets/qr/content-code-examples/how-to/implement-custom-qr-code-foreground.cs
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");
Imports IronQr
Imports IronSoftware.Drawing

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

' Set background color
Dim styleOptions As New QrStyleOptions() With {
    .Color = Color.PaleVioletRed
}

' Save QR code with custom background
Dim qrImage As AnyBitmap = qr.Save(styleOptions)
qrImage.SaveAs("qrBackgroundColor.png")
$vbLabelText   $csharpLabel
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.

Ahmad Sohail
Full Stack Developer

Ahmad is a full-stack developer with a strong foundation in C#, Python, and web technologies. He has a deep interest in building scalable software solutions and enjoys exploring how design and functionality meet in real-world applications.

Before joining the Iron Software team, Ahmad worked on automation projects ...

Read More
Ready to Get Started?
Nuget Downloads 60,166 | Version: 2026.3 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronQR
run a sample watch your URL become a QR code.