| Return to SAS Notes and Concepts for ODS
|
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:
|
|
|
For more help in choosing colors, including which colors are "Web-safe," see
| 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. |