Skip to content

Commit d79eb87

Browse files
committed
Use the Background color from ColorScheme if bc implements BarcodeColor
1 parent d5743d9 commit d79eb87

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scaledbarcode.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ func (bc *intCSscaledBC) CheckSum() int {
4949

5050
// Scale returns a resized barcode with the given width and height.
5151
func Scale(bc Barcode, width, height int) (Barcode, error) {
52-
return ScaleWithFill(bc, width, height, color.White)
52+
var fill color.Color
53+
if v, ok := bc.(BarcodeColor); ok {
54+
fill = v.ColorScheme().Background
55+
} else {
56+
fill = color.White
57+
}
58+
return ScaleWithFill(bc, width, height, fill)
5359
}
5460

5561
// Scale returns a resized barcode with the given width, height and fill color.

0 commit comments

Comments
 (0)