Modify Barcode Color Scheme

In this article, the options available in Aspose.BarCode for Node.js via Java to manage barcode color scheme and its key elements are descsribed.

Overview

Usually barcode images have the black-and-white color scheme. To provide the possibilty of modifying barcode colors, Aspose.BarCode for Node.js via Java enables customizing system RGB colors for key barcode elements, including the following:

  • Bars
  • Background
  • Text label
  • Top and bottom captions
  • Borders

Background Color

Barcode background color can be modified through the setBackColor method of BaseGenerationParameters class. The default value of background color is White.

The barcode image with background color set to Color.Green is provided below.

Bar Color

To manage the color of bars, the setBarColor method of BarcodeParameters class needs to be used. By default, bar color is set to Black.

The barcode image below has been generated with the bar color setting Color.Green.

Border Color

Border color can be adjusted through the setColor method of class BorderParameters. The default border color is Black. The barcode image below has been generated with border color set to Color.Green.

Main Text Color

Aspose.BarCode for Node.js in Java provides the possibility to customize the color of main text label displayed on a barcode image. It can be done by calling the setColor method of class CodeTextParameters. The default setting of main text color is Black. The sample barcode image shown below has been generated with the customized barcode text color setting (Color.Green).

Caption Color

In Aspose.BarCode for Node.js in Java, barcode images can be generated with top and bottom captions. Caption color can be customized using the setTextColor method of class CaptionParameters. Sample images below have been created with the color setting set to Color.Green.

Caption Color