@@ -328,16 +328,18 @@ def _init(self, code):
328328 self ._group .appendChild (background )
329329
330330 def _create_module (self , xpos , ypos , width , color ):
331- element = self ._document .createElement ("rect" )
332- attributes = {
333- "x" : SIZE .format (xpos ),
334- "y" : SIZE .format (ypos ),
335- "width" : SIZE .format (width ),
336- "height" : SIZE .format (self .module_height ),
337- "style" : f"fill:{ color } ;" ,
338- }
339- _set_attributes (element , ** attributes )
340- self ._group .appendChild (element )
331+ # Background rect has been provided already, so skipping "spaces"
332+ if color != self .background :
333+ element = self ._document .createElement ("rect" )
334+ attributes = {
335+ "x" : SIZE .format (xpos ),
336+ "y" : SIZE .format (ypos ),
337+ "width" : SIZE .format (width ),
338+ "height" : SIZE .format (self .module_height ),
339+ "style" : f"fill:{ color } ;" ,
340+ }
341+ _set_attributes (element , ** attributes )
342+ self ._group .appendChild (element )
341343
342344 def _create_text (self , xpos , ypos ):
343345 # check option to override self.text with self.human (barcode as
0 commit comments