Customizing Barcode Color Scheme in C#
This article describes the options provided by Aspose.BarCode for .NET to adjust the color scheme of a barcode image and its main elements.
Generally, barcode images are created in black and white colors. However, to address the necessity to generate barcode labels of different colors, Aspose.BarCode for .NET enables customizing system RGB color for key barcode elements, such as:
- Barcode text
- Top and bottom captions
Barcode Background Color
The barcode image generated with adjusted background color settings (Color.Green) is demonstrated below.
The following code snippet illustrates how to set a barcode background color.
The following image represents the barcode label generated with the customized bar color settings (Color.Green).
The code snippet provided below explains how to adjust bar color.
It is possible to vary barcode border color by setting the Color property of class BorderParameters. By default, the color of borders is set to Black. The barcode image provided below has been created setting border color to (Color.Green).
The following code example is used to change the color of barcode borders.
Barcode Text Color
The color of barcode text that may be placed on a barcode image can be adjusted as well. To do this, it is required to initialize the Color property in property group CodeTextParameters. By default, the color of barcode text is set to Black. The sample barcode image shown below has been generated with the customized barcode text color setting (Color.Green).
The following code snippet demonstrates how to change barcode text color.
Barcode images created using Aspose.BarCode for .NET may have top and/or bottom captions according to the will of a developer. The color of these elements can be adjusted by setting the value to the TextColor property in property group CaptionParameters. The following barcode images have been generated using the customized caption color settings (Color.Green).
|Adjusting Caption Color|
The code example given below explains how to adjust caption color for top and bottom captions.