It is advisable to generate dark color barcode on the light background to differentiate between barcode and spaces. Best contrast to make barcode scannable is black barcode on white background. Contrary, White color barcode on black background is not readable. Colored header and footer do not affect the readability of barcode.
Good Bar Colors:
Black, Green, Blue, Dark Brown
Good Space Colors:
White, Red, Yellow, Orange
Barcode Color Guide
Barcode reader uses a red light to scan the reflected area, thus interprets the red background as white. Light color barcodes are not scannable on light background. Similarly, dark color barcodes are not scannable on dark background. There should be good contrast between bar color and background color.
In the following examples scannable barcodes are indicated by green tick mark and non-scannable barcodes are marked by red cross mark: