Color-Naming Schemes

Introduction to Color-Naming Schemes

The valid color-naming schemes are as follows:
  • RGB (red green blue)
  • RGBA (red green blue transparency)
  • CMYK (cyan magenta yellow black)
  • HLS (hue lightness saturation)
  • HSV (hue saturation brightness), also called HSB
  • Gray scale
  • SAS color names (from the SAS Registry)
  • SAS Color Naming System (CNS)
Examples of Specifying Colors shows examples of each color-naming scheme.
Examples of Specifying Colors
Color-Naming Scheme
Example
RGB
COLORS=(cx98FB98 cxDDA0DD cxFFDAB9 cxDB7093 cxB0E0E6)
RGBA1
COLORS=(a98FB9833 aDDA0DD66 aFFDAB999 aDB7093CC aB0E0E6FF)
CMYK
COLORS=("FF00FF00" "00FFFF00" "FFFFFF00")
HLS
COLORS=(H14055FF H0F060FF H0B485FF H07880FF)
HSV
COLORS=(V0F055FF v010FFFF v03BFFFF v12C55E8)
Gray Scale
COLORS=(GRAY4F GRAY6D GRAY8A GRAYC3)
SAS Registry Colors
COLORS=(palegreen plum peachpuff palevioletred powderblue)
CNS Color Names
COLORS=("very light purplish blue" 
"light vivid green" "medium strong yellow" 
"dark grayish green")
1RGBA color mode is not supported by Java devices. RGBA color mode is supported by ActiveX devices when the output is used in Microsoft applications.
You can also mix color-naming schemes in the same statement, for example:
 goptions colors=(cxEE0044 "vivid blue" darkgreen);
Note: Hardware characteristics of your output device might cause some colors with different color definitions to appear the same. The same color is likely to appear different on different devices and might not appear correctly on some devices. To determine whether your device supports a specific color-naming scheme, refer to your graphics device documentation.
Each of the color-naming schemes supported by SAS/GRAPH has its advantages and disadvantages based on how the output is used. For example, if you are creating a report that will be viewed online only, then specifying colors using the RGB naming scheme or the SAS color names defined in the registry might produce better results. If you are creating a report for publishing in printed form, you might want to use the CMYK color-naming scheme.
Note: Invalid color names, such as a misspelled color name, are mapped to gray, and a NOTE is issued to the SAS log. A valid color name that is not supported by the current device is mapped to the closest color that is supported by the device.
For additional information about color-naming schemes, see Effective Color Displays: Theory and Practice by David Travis and Computer Graphics: Principles and Practice by Foley, van Dam, Feiner, and Hughes.

RGB Color Codes

The RGB color-naming scheme is usually used to define colors for a display screen. This color-naming scheme is based on the properties of light. With RGB color codes, a color is defined by its red, green, and blue components. Individual amounts of each color are added together to create the desired color. All the colors combined together create white. The absence of all color creates black.
Color names are in the form CXrrggbb, where the following is true:
  • CX indicates to SAS that this is an RGB color specification.
  • rr is the red component.
  • gg is the green component.
  • bb is the blue component.
The components are given as hexadecimal numbers in the range 00 through FF (0% to 100%), where lower values are darker and higher values are lighter. This scheme allows for up to 256 levels of each color component (more than 16 million different colors).
Examples of RGB Color Values
Color
RGB Value
Red
CXFF0000
Green
CX00FF00
Blue
CX0000FF
White
CXFFFFFF
Black
CX000000
Any combination of the color components is valid. Some combinations match the colors produced by predefined SAS color names. For information about viewing the RGB combinations that match predefined SAS color names, see Using the SAS Registry to Control Color in SAS Language Reference: Concepts.

RGBA Color Codes

The RGBA color-naming scheme is the same as the RGB color scheme, except that RGBA also supports variable transparency.See Using Transparency for more information.p06kdvbdiulixcn1traua7qrtn4b
Color names are in the form arrggbbaa, where the following is true:
  • a indicates to SAS that this is an RGBA color specification.
  • rr is the red component.
  • gg is the green component.
  • bb is the blue component.
  • aa is the transparency component.
As with the RGBA color scheme, the components are given as hexadecimal numbers in the range 00 through FF (0% to 100%). The transparency component defines the intensity (opacity) of the color.
Examples of RGBA Color Values
Color
RGBA Value
Red, very transparent
aFF000015
Red, 20% opaque
aFF000033
Green, 40% opaque
a00FF0066
Blue, 60% opaque
a0000FF99
Blue, 80% opaque
a0000FFCC
Black, completely opaque
a000000FF
Any combination of the color components is valid. Some combinations match the colors produced by predefined SAS color names. For information about viewing the RGB combinations that match predefined SAS color names, see Using the SAS Registry to Control Color in SAS Language Reference: Concepts.

CMYK Color Codes

CMYK is a color-naming scheme used in four-color printing. CMYK is based on the principles of objects reflecting light. Combining equal values of cyan, magenta, and yellow produces process black, which might not appear as pure black. The black component (K) of CMYK can be used to specify the level of blackness in the output. A lack of all colors produces white, when the output is printed on white paper.
To specify the colors from a printer's Pantone Color Look-Up Table, you can use the CMYK color-naming scheme. Specify colors in terms of their cyan, magenta, yellow, and black components. Color names are of the form ccmmyykk, where the following is true:
  • cc is the cyan component.
  • mm is the magenta component.
  • yy is the yellow component.
  • kk is the black component.
The components are given as hexadecimal numbers in the range 00 through FF, where higher values are darker and lower values are brighter. This scheme allows for up to 256 levels of each color component. Quotation marks are required when the color value starts with a number instead of a letter.
Examples of CMYK Color Values
Color
CMYK Value
Red
00FFFF00
Green
FF00FF00
Blue
FFFF0000
White
00000000
Process black (using cyan, magenta, and yellow ink)
FFFFFF00
Pure black (using only black ink)
000000FF
Note: You can specify a CMY value by making the kk, the color's black component, zero (00).
CMYK color specifications are for devices that support four colors. If a CMYK color is used on a three-color device, the device processes the color specification. The resulting colors might not be as expected. Different CMYK colors might map to the same device color because a four-color space supports more colors than a three-color space.

HLS Color Codes

The HLS color-naming scheme follows the Tektronix Color Standard illustrated in Tektronix Color Standard. To make the HLS color model consistent with the HSV coordinate system, Tektronix places blue at zero degrees. With the HLS color naming-scheme, you specify colors in terms of hue, lightness, and saturation levels. HLS color names are of the form Hhhhllss, where the following is true:
  • H indicates that this is an HLS color specification.
  • hhh is the hue component.
  • ll is the lightness component.
  • ss is the saturation component.
The components are given as hexadecimal numbers. The hue component has the range of 000 through 168 hexadecimal (168 hexadecimal is equivalent to 360 decimal). Both the lightness and saturation components are hexadecimal and scaled to a range of 0 to 255 expressed with values of 00 through FF (0% to 100%). Thus, they provide 256 levels for each component.
Examples of HLS Color Codes
Color
HLS Color Code
Red
H07880FF
Green
H0F080FF
Blue
H00080FF
Light gray
H000BB00
White1
HxxxFF00, such as H000FF00
Black1
Hxxx0000 such as H0000000
1When the saturation is set to 00, the color is a shade of gray that is determined by the lightness value. Therefore, white is defined as HxxxFF00 and black as Hxxx0000, where xxx can be any hue.
Tektronix Color Standard
Tektronix Color Standard

HSV (or HSB) Color Codes

Specify the HSV color-naming scheme in terms of hue, saturation, and value (or brightness) components. HSV color names are of the form Vhhhssvv, where the following is true:
  • V indicates that this is an HSV color specification.
  • hhh is the hue component.
  • ss is the saturation component.
  • vv is value or brightness component.
The components are given as hexadecimal numbers. The hue component has the range of 000 through 168 hexadecimal (168 hexadecimal is equivalent to 360 decimal). Both the saturation and value (brightness) components are hexadecimal, scaled to a range of 0 to 255, and expressed with values of 00 through FF. Thus, they provide 256 levels for each component.
Examples of HSV (or HSB) Color Codes
Color
HSV Color Code
Red
V000FFFF
Green
V078FFFF
Blue
V0F0FFFF
Light gray1
Vxxx00BB such as V07900BB
White1
Vxxx00FF such as V07900FF
Black1
Vxxx00000 such as V0790000
1When the saturation is set to 00, the color is a shade of gray. The value component determines the intensity of gray level. The xxx can be any hue.

Gray-Scale Color Codes

Specify the lightness or darkness of gray using the word GRAY and a lightness value. Gray-scale color codes are of the form GRAYll. The value ll is the lightness of the gray and is given as a hexadecimal number in the range 00 through FF. This scheme allows for 256 levels on the gray scale.
Note: GRAY, without a lightness value, is a SAS color name defined in the SAS registry. (See SAS Color Names and RGB Values in the SAS Registry.) Its value is CX808080. Invalid color specifications are mapped to GRAY.
Examples of Gray-Scale Color Codes
Color
Gray-Scale Color Codes
RGB Equivalent
white
GRAYFF
CXFFFFFF
light gray
GRAYC0
CXC0C0C0
dark gray
GRAY40
CX404040
Black
GRAY00
CX000000

SAS Color Names and RGB Values in the SAS Registry

SAS provides, in the SAS Registry, a set of color names and RGB values that you can use to specify colors. These color names and RGB values are common to most Web browsers. You can specify the name itself or the RGB value associated with that color name. To view the color names as associated RGB values that are defined in the registry, submit the following code;
proc registry list
 startat="COLORNAMES";
run;
SAS prints the output in the SAS log.
You can also create your own color values by adding them to the registry. For information about viewing and modifying the list of color names, see Using the SAS Registry to Control Color in SAS Language Reference: Concepts.

Color Naming System (CNS) Values

With CNS, you specify a color value by specifying lightness, saturation, and hue, in that order, using the terms shown in the following table.
Color Naming System Values
Lightness
Saturation
Hue
Black
Gray
Blue
Very Dark
Grayish
Purple
Dark
Moderate
Red
Medium
Strong
Orange/Brown
Light
Vivid
Yellow
Very Light
Green
White
Follow these rules when you are determining the CNS color name:
  • The lightness values black and white should not be used with saturation or hue values.
  • If not specified, medium is the default lightness value and vivid is the default saturation value.
  • Gray is the only saturation value that can be used without a hue.
  • Unless the color that you want is black, white, or some form of gray, you must specify at least one hue.
One or two hue values can be used in the CNS color name. When using two hue values, the hues must be adjacent to each other in the following list: blue, purple, red, orange/brown, yellow, green, and then returning to blue. When two hues are used, the resulting color is a combination of both colors. Use the suffix ish to reduce the effect of a hue when two hues are combined. Reddish purple is less red than red purple. If you are using a color with an ish suffix, this color must precede the color without the ish suffix.
Color names can be written in the following ways:
  • without space separators between words
  • with an underscore to separate words
  • with a space to separate words, enclosed in quotation marks
For example, the following are all valid color specifications:
  • verylightmoderatepurplishblue
  • very_light_moderate_purplish_blue
  • “very light moderate purplish blue”
Note: If a CNS color name is also a color name in the SAS Registry, the SAS Registry color value takes precedence. Some CNS color names and color names in the SAS Registry have different color values. To use a CNS color value when the color name is also in the SAS Registry, do the following:
  • Include a space to separate the words.
  • Enclose the entire color name in quotation marks.