color

Color Values. You can specify color values using either hexadecimal notation, a comma-separated list of component values, or decimals.

color

{{ gray[, alpha][g]}|

{ red, green, blue[ , rgbAlpha][r]}|

{ cyan, magenta, yellow, black[,alpha]k}|

{0x{hex2|hex4}[g]}|

{[0x]{ hex6| hex8}[r]}|

{[0x]{ hex8| hex10}k}}[s]

red, green, blue, rgbAlpha

color component value (0...255, decimal int)

cyan, magenta, yellow, black, alpha

CMYK color component value (0..100 %, decimal int)

gray, alpha

gray color component value (0…100%, decimal int)

hex2

packed two digit hex gray color value (GG)

hex4

packed four digit hex gray with alpha color value (GGAA)

hex6

packed six digit hexadecimal RGB color value (RRGGBB)

hex8

packed eight digit hexadecimal RGBA (RRGGBBAA) or CMYK (CCMMYYKK) color value (if specified with 'k' suffix)

hex10

packed ten digit hexadecimal CMYK with alpha value (CCYYMMKKAA)

Decimal component values for RGB colors are in the range 0…255. Decimal component values for CMYK and gray are in the range 0…100%. All hexadecimal component values are in the range 0…0xFF.

Color component values are assumed to be independent of the alpha value (not pre-multiplied).

All color values, prefixes, and suffixes are not case sensitive.

The type suffix ‘k’ is required for CMYK color values. A type suffix can be optionally specified for RGB and gray color values.

The prefix ‘0x’ is required for hexadecimal gray color values.

The ‘s’ suffix specifies that the color value is associated with the input (source) color space corresponding to the pixel type of the color value (defined with attribute::IccProfileSrc*). If this suffix is not present, the color value is associated with the output (destination) color space (defined with icc= or attribute::IccProfile*).

Default

If an alpha value is not specified explicitly it is assumed to be 255, 0xFF, or 100% (fully opaque).

Examples

Some examples of valid color specifiers, and their corresponding pixel type, color value, alpha value, and default color space:

color Pixel Type Color Value Alpha Value Default Color Space

0,100,200

RGB

0,100,200

255

IccProfileRgb

0,100,200,200rs

RGB

0,100,200

200

IccProfileSrcRgb

0x010203S

RGB

1,2,3

255

IccProfileSrcRgb

a0b1c2d3R

RGB

160,177,194

211

IccProfileRgb

100S

gray

100%

100%

IccProfileSrcGray

50,75g

gray

50%

75%

IccProfileGray

0X70G

gray

44%

44%

IccProfileGray

0xddeegs

gray

87%

93%

IccProfileSrcGray

94,11,50,33k

CMYK

94-11-50-33%

100%

IccProfileCmyk

22,23,24,25,26KS

CMYK

22-23-24-25%

26%

IccProfileSrcCmyk

38393A3bK

CMYK

56-57-58-59%

100%

IccProfileCmyk

0x0a0b0C0d0eks

CMYK

10-11-12-13%

14%

IccProfileSrcCmyk

The output color space specified with icc= applies instead of the default color space when the pixel type of an output color corresponds to the pixel type of the output image.

On this page