alexzhirkevich/qrose

add background color

Opened this issue · 0 comments

Discussed in #7

Originally posted by idrisalshikh June 13, 2024
I've tried to change the background color without success, and I believe this is very important. By default, the QR code color is black, and the background color is determined by the surface where the QR image is displayed. If our design uses a black background, the generated image will be entirely black, making the QR code invisible.

In our application, we can resolve this by changing the background of our container that displays the image. However, the real issue arises when we need to share or save the image as a JPEG. In JPEG format, there is no transparency, so the generated image will have a black background. Since the default QR code color is black, we end up with an all-black image again.

When saving the image in PNG format, I encountered a problem when trying to share the image on WhatsApp; it still appears as a black image. Even if I change the QR code colors to:
colors {
dark = QrBrush.solid(Color.Blue)
frame = QrBrush.solid(Color.Blue)
light = QrBrush.solid(Color.Red)
ball = QrBrush.solid(Color.Blue)
}

image

The image still shows a white background (which represents my application's background color). When I share this image, it looks different because the background changes.

Image

As a result, it would be beneficial if we could control the background color of the QR image directly and add an outer border to ensure consistency across different platforms and formats.