Use the Background color from ColorScheme if bc implements BarcodeColor

This commit is contained in:
zhaori96 2024-08-02 12:35:17 -03:00
parent d5743d95af
commit d79eb8727b
1 changed files with 7 additions and 1 deletions

View File

@ -49,7 +49,13 @@ func (bc *intCSscaledBC) CheckSum() int {
// Scale returns a resized barcode with the given width and height. // Scale returns a resized barcode with the given width and height.
func Scale(bc Barcode, width, height int) (Barcode, error) { 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. // Scale returns a resized barcode with the given width, height and fill color.