DocumentationDynamic Media Image Serving and Rendering API

color

Last update: August 1, 2023
  • Topics:
  • Dynamic Media Classic,SDK/API

CREATED FOR:

  • Developer
  • User

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, rgbAlphacolor component value (0...255, decimal int)
cyan, magenta, yellow, black, alphaCMYK color component value (0..100 %, decimal int)
gray, alphagray color component value (0…100%, decimal int)
hex2packed two-digit hex gray color value (GG)
hex4packed four digit hex gray with alpha color value (GGAA)
hex6packed six-digit hexadecimal RGB color value (RRGGBB)
hex8packed eight-digit hexadecimal RGBA (RRGGBBAA) or CMYK (CCMMYYKK) color value (if specified with 'k' suffix)
hex10packed 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:

colorPixel TypeColor ValueAlpha ValueDefault Color Space
0,100,200RGB0,100,200255IccProfileRgb
0,100,200,200rsRGB0,100,200200IccProfileSrcRgb
0x010203SRGB1,2,3255IccProfileSrcRgb
a0b1c2d3RRGB160,177,194211IccProfileRgb
100Sgray100%100%IccProfileSrcGray
50,75ggray50%75%IccProfileGray
0X70Ggray44%44%IccProfileGray
0xddeegsgray87%93%IccProfileSrcGray
94,11,50,33kCMYK94-11-50-33%100%IccProfileCmyk
22,23,24,25,26KSCMYK22-23-24-25%26%IccProfileSrcCmyk
38393A3bKCMYK56-57-58-59%100%IccProfileCmyk
0x0a0b0C0d0eksCMYK10-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.

recommendation-more-help
a26166cd-f2f4-45ce-996d-96a0f0d6cf49