From d79eb8727b08e5b3cb34f14a9633f09fef8108f3 Mon Sep 17 00:00:00 2001 From: zhaori96 Date: Fri, 2 Aug 2024 12:35:17 -0300 Subject: [PATCH] Use the Background color from ColorScheme if bc implements BarcodeColor --- scaledbarcode.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scaledbarcode.go b/scaledbarcode.go index 1e87a2a..491cc3f 100644 --- a/scaledbarcode.go +++ b/scaledbarcode.go @@ -49,7 +49,13 @@ func (bc *intCSscaledBC) CheckSum() int { // Scale returns a resized barcode with the given width and height. func Scale(bc Barcode, width, height int) (Barcode, error) { - return ScaleWithFill(bc, width, height, color.White) + var fill color.Color + if v, ok := bc.(BarcodeColor); ok { + fill = v.ColorScheme().Background + } else { + fill = color.White + } + return ScaleWithFill(bc, width, height, fill) } // Scale returns a resized barcode with the given width, height and fill color.