These functions can be used in expressions associated with setting and evaluating the color properties of chart objects, as well as in load scripts.

Information noteQlikView supports the color functions qliktechblue and qliktechgray for backwards compatibility reasons, but use of them is not recommended.

Use the drop-down on each function to see a brief description and the syntax of each function. Click the function name in the syntax description for further details.

ARGB() is used in expressions to set or evaluate the color properties of a chart object, where the color is defined by a red component r, a green
component g, and a blue component
b, with an alpha factor (opacity)
of alpha.

HSL() is used in expressions to set or evaluate the color properties of a chart object, where the color is defined by
values of hue, saturation, and luminosity between 0 and 1.

RGB() is used in expressions to set or evaluate the color properties of a chart object, where the color is defined by a red component r, a green
component g, and a blue component
bwith values between 0 and 255.

Color() is used in expressions to return the color representation of color number n in the chart palette shown in the chart properties. The color representation is a dual value where the text representation comes in the form of 'RGB(r, g, b)' where r, g and b are numbers between 0 and 255 representing the red, green and blue color value respectively. The number representation is an integer representing the red, green and blue components.

Color (n)

Returns the RGB color representation for black (RGB 0,0,0). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Black ([alpha])

Returns
the RGB color representation for dark gray (RGB 128,128,128). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Darkgray ([alpha])

Returns
the RGB color representation for light gray (RGB 192,192,192). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Lightgray ([alpha])

Returns
the RGB color representation for white (RGB 255,255,255). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

White ([alpha])

Returns
the RGB color representation for blue (RGB 0,0,128). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Blue ([alpha])

Returns
the RGB color representation for light blue (RGB 0,0,255). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Lightblue ([alpha])

Returns
the RGB color representation for green (RGB 0,128,0). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Green ([alpha])

Returns
the RGB color representation for light green (RGB 0,255,0). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Lightgreen ()

Returns
the RGB color representation for cyan (RGB 0,128,128). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Cyan ([alpha])

Returns
the RGB color representation for light cyan (RGB 0,255,255). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Lightcyan ()

Returns
the RGB color representation for red (RGB 128,0,0). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Red ([alpha])

Returns
the RGB color representation for light red (RGB 255,0,0). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Lightred ([alpha])

Returns
the RGB color representation for magenta (RGB 128,0,128). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Magenta ([alpha])

Returns
the RGB color representation for light magenta (RGB 255,0,255). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Lightmagenta ([alpha])

Returns
the RGB color representation for brown (RGB 128,128,0). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Brown ([alpha])

Returns
the RGB color representation for yellow (RGB 255,255,0). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

Yellow ([alpha])

Returns
the RGB color representation for QT blue (RGB 96,112,169). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

qliktechblue ([alpha])

Returns
the RGB color representation for QT gray (RGB 166,166,166). Optionally a parameter for alpha factor can be given. An alpha of 0 corresponds to full transparency. An alpha of 255 corresponds to full opacity. If a value for alpha is not entered, it is assumed to be 255.

qliktechgray ([alpha])

Colormix1() is used in expressions to return an ARGB value from a two color gradient, based on a value between 0 and 1.

Colormix1 (Value , ColorZero , ColorOne)

Value is a real number between 0 and 1.

If Value = 0 ColorZero is returned.

If Value = 1 ColorOne is returned.

If 0 < Value< 1 the appropriate intermediate shading is returned.

ColorZero is a valid RGB color representation for the color to be associated with the low end of the interval.

ColorOne is a valid RGB color representation for the color to be associated with the high end of the interval.

Example:

Colormix1(0.5, red(), blue())

returns ARGB(255,64,0,64) (purple)

Colormix2() is used in expressions to return an ARGB value from a two color gradient, based on a value between -1 and 1, with the possibility to specify an intermediate color for the center (0) position.

If -1 < Value< 1 the appropriate color mix is returned.

ColorMinusOne is a valid RGB color representation for the color to be associated with the low end of the interval.

ColorOne is a valid RGB color representation for the color to be associated with the high end of the interval.

ColorZero is an optional valid RGB color representation for the color to be associated with the center of the interval.

SysColor() returns the ARGB value for the Windows system color nr, where nr corresponds to the parameter to the Windows API function GetSysColor(nr).

SysColor (nr)

ColorMapHue() returns an ARGB value of a color from a colormap that varies the hue component of the HSV color model. The colormap starts with red, passes through yellow, green, cyan, blue, magenta, and returns to red. x must be specified as a value between 0 and 1.

ColorMapHue (x)

ColorMapJet() returns an ARGB value of a color from a colormap that starts with blue, passes through cyan, yellow and orange, and returns to red. x must be specified as a value between 0 and 1.

ColorMapJet (x)

Pre-defined color functions

The following functions can be used in expressions for pre-defined colors. Each function returns an RGB color representation.

Optionally a parameter for alpha factor can be given, in which case an ARGB color representation is returned. An alpha factor of 0 corresponds to full transparency, and an alpha factor of 255 corresponds to full opacity.

Color function

RGB value

black ([alpha])

(0,0,0)

blue([alpha])

(0,0,128)

brown([alpha])

(128,128,0)

cyan([alpha])

(0,128,128)

darkgray([alpha])

(128,128,128)

green([alpha])

(0,128,0)

lightblue([alpha])

(0,0,255)

lightcyan([alpha])

(0,255,255)

lightgray([alpha])

(192,192,192)

lightgreen([alpha])

(0,255,0)

lightmagenta([alpha])

(255,0,255)

lightred([alpha])

(255,0,0)

magenta([alpha])

(128,0,128)

red([alpha])

(128,0,0)

white([alpha])

(255,255,255)

yellow([alpha])

(255,255,0)

Examples and results:

Examples

Results

Blue()

RGB(0,0,128)

Blue(128)

ARGB(128,0,0,128)

Join the Analytics Modernization Program

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com