FOCUS AREAS

Return to SAS Notes and Concepts for ODS

Base SAS

SAS Notes and Concepts for ODS

Colors Concepts


Overview

You can modify the colors of an HTML page by using the TEMPLATE procedure. A color value can be either a literal value, an RGB value, any of the names that are supported by SAS/GRAPH, an HLS value, or a gray scale value.

Here are examples of RGB values that specify colors.

Color Hex RGB Value on Black on White
BLUE #0033AA BLUE BLUE
DODGER BLUE #0066AA DODGER BLUE DODGER BLUE
MEDIUM BLUE #004488 MEDIUM BLUE MEDIUM BLUE
AZURE #F0F0F0 AZURE AZURE
PALE GREEN #AAFFAA PALE GREEN PALE GREEN
CRIMSON #880000 CRIMSON CRIMSON
GREY #E0E0E0 GREY GREY
LIGHT GREY #D3D3D3 LIGHT GREY LIGHT GREY

Default colors are defined in the template store Sashelp.Tmplmst. See a SAS Note about viewing template source.

In the interactive mode, you can select Styles -> Default to open a template in browse mode. To open it in edit mode, use the right mouse button to select it.

The Default template specifies all default styles for the output, including colors--for example, the various background and foreground colors. In the template you will see the following lists (shortened here):

.
.
.
 style color_list /
     'fgB2'       = cx0066AA       /* DODGER BLUE      */
     'fgB1'       = cx004488       /* MEDIUM BLUE      */
     'fgA4'       = cxAAFFAA       /* PALEGREEN        */
     'bgA4'       = cx880000       /* CRIMSON          */
     'bgA3'       = cxD3D3D3       /* LIGHT GRAY       */
     'fgA2'       = cx0033AA       /* BLUE             */
     'bgA2'       = cxB0B0B0       /* LIGHT GRAY       */
     'fgA1'       = cx000000       /* BLACK            */
     'bgA1'       = cxF0F0F0       /* AZURE            */
     'fgA'        = cx002288       /* MEDIUM BLUE      */
     'bgA'        = cxE0E0E0;      /* GREY             */


      style colors /
         'headerfgemph' = color_list('fgA2')
         'headerbgemph' = color_list('bgA2')
         'headerfgstrong' = color_list('fgA2')
         'headerbgstrong' = color_list('bgA2')
         'headerfg' = color_list('fgA2')
         'headerbg' = color_list('bgA2')
         'datafgemph' = color_list('fgA1')
         'databgemph' = color_list('bgA3')
         'datafgstrong' = color_list('fgA1')
         'databgstrong' = color_list('bgA3')
         'datafg' = color_list('fgA1')
         'databg' = color_list('bgA3')
         'batchbg' = color_list('bgA2')
         'batchfg' = color_list('fgA2')
         'tableborder' = color_list('fgA1')
         'tablebg' = color_list('bgA1')
.
.
.

In the template, STYLE COLOR_LIST and COLORS work together in an array fashion to assign color values. This is a programming trick to enable you to change a color assignment once for multiple locations. For example, if you change the literal assigned to fgA2, you effectively change that color in multiple places -- headerfgemph, headerfgstrong, headerfg, and so on.

See the PROC TEMPLATE topics in SAS Output Delivery System: User's Guide for details about modifying and creating templates. This book is available in the Base SAS section of the SAS online documentation. To associate a new template with a procedure, use the STYLE= option in the ODS statement.

Looking at example 1 in SAS Note 23318, the REPLACE statement changes the color associated to bgA. In the Default template, bgA is assigned to various parts of the output. Therefore, one REPLACE statement changes the colors for all of those assignments

You can also replace a color by modifying the assignment in the appropriate style element. See example 2 of SAS Note 23318. Because the FROM is used, all attributes other than the background color are inherited from the style-element Document. Only the BACKGROUND of Body is changed.

Here are more RGB values that you can use in HTML output:

WHITE #FFFFFF
BLUE#0000FF
YELLOW #FFF00
BLUE VIOLET #9F5F9F
BROWN #A62A2A
CADET BLUE #5F9F9F
DARK BROWN #5C4033
DARK PURPLE #871F78
DUSTY ROSE #856363
GOLD #CD7F32
KHAKI #9F9F5F
NAVY BLUE #23238E
PINK #BC8F8F
SILVER #E6E8FA
TURQUOISE #ADEAEA
RED#FF0000
MAGENTA #FF00FF
BLACK #000000
BRASS #B5A642
BRONZE #8C7853
COPPER #B87333
DARK GREEN #2F4F2F
DARK TAN #97694F
FIREBRICK #8E2323
GREY #C0COCO
LIME GREEN 32CD32
ORANGE #FF7F00
PLUM #EAADEA
STEEL BLUE #236B8E
VIOLET #4F2F4F
GREEN#00FF00
CYAN #00FFFF
AQUAMARINE #70DB93
BRIGHT GOLD #D9D919
BRONZE II #A67D3D
CORAL #FF7F00
DARK WOOD #855E42
DIM GREY #545454
FOREST GREEN #238E23
INDIAN RED #4E2F2F
MAROON #8E236B
ORCHARD #DB70DB
SCARLET #8C1717
TAN #DB9370
WHEAT #D8D8BF

For more help in choosing colors, including which colors are "Web-safe," see


Colors FAQ



The concepts remain above, but the FAQ has been moved.
All PROC TEMPLATE FAQ have been added to the support.sas.com SAS Notes application for greater usability.
Check it out!

See the "Colors" link under ODS HTML.