BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KarolineN
Obsidian | Level 7

Dear Community,

 

I am working on a bar graph that uses default colors (color of the bars) and I need to know the code (names) for those colors. 

Is there any way to find out what the code (names) for(of) those exact colors are? 

Thank you for any suggestions!

 

Best regards,

Karoline

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Use proc template to list the definition of the ODS Style you are using.

Example:

proc template;
   source styles.htmlblue;
run;

You may need to search for the color definitions depending on exactly which style you place on the Source statement. The colors might be defined in the parent and may need to look at the parent to map other values used for colors.

The output from the above my system is:

610  proc template;
611     source styles.htmlblue;
define style Styles.Htmlblue;
   parent = styles.statistical;
   class GraphColors /
      'gndata12' = cxECE8C4
      'gndata11' = cxDBD8F8
      'gndata10' = cxC6E4BF
      'gndata9' = cxE6CEAD
      'gndata8' = cxE5C1D4
      'gndata7' = cxCCDFF0
      'gndata6' = cxDDDEB5
      'gndata5' = cxDBC7E7
      'gndata4' = cxD5C6B4
      'gndata3' = cxB7D4D3
      'gndata2' = cxE7B3B4
      'gndata1' = cxBBC2DC
      'gndata' = cxBBC2DC
      'gofill' = cxFAFBFE
      'gblockheader' = cxcfd5de
      'gcphasebox' = cx989EA1
      'gphasebox' = cxDBE6F2
      'gczonec' = cxBECEE0
      'gzonec' = cxCCDCEE
      'gczoneb' = cxCCDCEE
      'gzoneb' = cxD7E5F3
      'gzonea' = cxE3EDF7
      'gconramp3cend' = cx9C1C00
      'gconramp3cneutral' = cx222222
      'gconramp3cstart' = cx0E36AC
      'gramp3cend' = cxD05B5B
      'gramp3cneutral' = cxFAFBFE
      'gramp3cstart' = cx667FA2
      'gcontrollim' = cxE6F2FF
      'gccontrollim' = cxBFC7D9
      'gruntest' = cxCAE3FF
      'gcruntest' = cxBF4D4D
      'gclipping' = cxFFFFC6
      'gcclipping' = cxC1C100
      'gaxis' = cx989EA1
      'greferencelines' = cx989EA1;
   class colors /
      'link2' = cx0000FF
      'link1' = cx800080
      'docbg' = cxFAFBFE
      'contentbg' = cxFAFBFE
      'systitlebg' = cxFAFBFE
      'titlebg' = cxFAFBFE
      'proctitlebg' = cxFAFBFE
      'headerbg' = cxEDF2F9
      'captionbg' = cxFAFBFE
      'captionfg' = cx112277
      'bylinebg' = cxFAFBFE
      'notebg' = cxFAFBFE
      'tablebg' = cxFAFBFE
      'batchbg' = cxFAFBFE
      'systitlefg' = cx112277
      'titlefg' = cx112277
      'proctitlefg' = cx112277
      'bylinefg' = cx112277
      'notefg' = cx112277;
   class Header /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class Footer /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class RowHeader /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class RowFooter /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class Table /
      cellpadding = 5;
   class Graph /
      attrpriority = "Color";
   class GraphFit2 /
      linestyle = 1;
   class GraphClipping /
      markersymbol = "circlefilled";
end;
NOTE: Path 'Styles.Htmlblue' is in: SASHELP.TMPLMST.
612  run;

The Gndataxx replace the default values assigned in the parent style of Styles.Statistical.

You will need to reference the SAS documentation for colors for the different ways of defining colors. Look in the documentation for "Color Naming Schemes". Here the values are RGB (the CX tells SAS that is the naming type) and the pairs of characters hold hex values of the 256 values possible for each of the reg, green and blue components of the displayed color.

 

The reference names for the color elements depends on which element. The GraphdataN are the basic names with up to 12 generally.

View solution in original post

6 REPLIES 6
ballardw
Super User

Use proc template to list the definition of the ODS Style you are using.

Example:

proc template;
   source styles.htmlblue;
run;

You may need to search for the color definitions depending on exactly which style you place on the Source statement. The colors might be defined in the parent and may need to look at the parent to map other values used for colors.

The output from the above my system is:

610  proc template;
611     source styles.htmlblue;
define style Styles.Htmlblue;
   parent = styles.statistical;
   class GraphColors /
      'gndata12' = cxECE8C4
      'gndata11' = cxDBD8F8
      'gndata10' = cxC6E4BF
      'gndata9' = cxE6CEAD
      'gndata8' = cxE5C1D4
      'gndata7' = cxCCDFF0
      'gndata6' = cxDDDEB5
      'gndata5' = cxDBC7E7
      'gndata4' = cxD5C6B4
      'gndata3' = cxB7D4D3
      'gndata2' = cxE7B3B4
      'gndata1' = cxBBC2DC
      'gndata' = cxBBC2DC
      'gofill' = cxFAFBFE
      'gblockheader' = cxcfd5de
      'gcphasebox' = cx989EA1
      'gphasebox' = cxDBE6F2
      'gczonec' = cxBECEE0
      'gzonec' = cxCCDCEE
      'gczoneb' = cxCCDCEE
      'gzoneb' = cxD7E5F3
      'gzonea' = cxE3EDF7
      'gconramp3cend' = cx9C1C00
      'gconramp3cneutral' = cx222222
      'gconramp3cstart' = cx0E36AC
      'gramp3cend' = cxD05B5B
      'gramp3cneutral' = cxFAFBFE
      'gramp3cstart' = cx667FA2
      'gcontrollim' = cxE6F2FF
      'gccontrollim' = cxBFC7D9
      'gruntest' = cxCAE3FF
      'gcruntest' = cxBF4D4D
      'gclipping' = cxFFFFC6
      'gcclipping' = cxC1C100
      'gaxis' = cx989EA1
      'greferencelines' = cx989EA1;
   class colors /
      'link2' = cx0000FF
      'link1' = cx800080
      'docbg' = cxFAFBFE
      'contentbg' = cxFAFBFE
      'systitlebg' = cxFAFBFE
      'titlebg' = cxFAFBFE
      'proctitlebg' = cxFAFBFE
      'headerbg' = cxEDF2F9
      'captionbg' = cxFAFBFE
      'captionfg' = cx112277
      'bylinebg' = cxFAFBFE
      'notebg' = cxFAFBFE
      'tablebg' = cxFAFBFE
      'batchbg' = cxFAFBFE
      'systitlefg' = cx112277
      'titlefg' = cx112277
      'proctitlefg' = cx112277
      'bylinefg' = cx112277
      'notefg' = cx112277;
   class Header /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class Footer /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class RowHeader /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class RowFooter /
      bordercolor = cxB0B7BB
      backgroundcolor = cxEDF2F9
      color = cx112277;
   class Table /
      cellpadding = 5;
   class Graph /
      attrpriority = "Color";
   class GraphFit2 /
      linestyle = 1;
   class GraphClipping /
      markersymbol = "circlefilled";
end;
NOTE: Path 'Styles.Htmlblue' is in: SASHELP.TMPLMST.
612  run;

The Gndataxx replace the default values assigned in the parent style of Styles.Statistical.

You will need to reference the SAS documentation for colors for the different ways of defining colors. Look in the documentation for "Color Naming Schemes". Here the values are RGB (the CX tells SAS that is the naming type) and the pairs of characters hold hex values of the 256 values possible for each of the reg, green and blue components of the displayed color.

 

The reference names for the color elements depends on which element. The GraphdataN are the basic names with up to 12 generally.

KarolineN
Obsidian | Level 7

Thank you very much! This solved my problem 🙂

Rick_SAS
SAS Super FREQ

See the article, "What colors does PROC SGPLOT use for markers?" Although the article talks about marker colors in a scatter plot, you can use similar ideas to find the fill colors in a bar chart.

 

Regarding the color "code" versus "name," the colors probably are only defined in terms of the RGB values (like CX556B2F). However, if you need a color NAME (like "Dark Olive Green"), there is a way to find the closest "color name" to a given RGB color. See "How to assign a name to a color."

KarolineN
Obsidian | Level 7

Thank you, this is very useful to know!

FreelanceReinh
Jade | Level 19

Hello @KarolineN,

 

As ballardw and Rick_SAS have explained, you can investigate ODS templates to find out the default color definitions. However, this assumes that you are using ODS graphics (and not traditional SAS/GRAPH output) and that you know the name of the current ODS style. Moreover, you have to match the colored graph elements in front of you to the correct items in a long list of abstract names such as "gndata1" that you read in the ODS template, which I find difficult.

 

Here is an alternative, very general approach that I have used in similar situations (using SAS under Windows):

 

  • Step 1: Take a screenshot of the graph or a relevant part of it to the clipboard. (You can use the convenient Alt+PrtScn keyboard shortcut, a built-in Windows tool such as Snip & Sketch or any other screenshot software.)
  • Step 2: Paste the screenshot into Windows Paint (or other suitable graphics editor software).
  • Step 3: Use the color picker tool (pipette icon) to click on an area of the screenshot with the color in question.
  • Step 4: In Paint: Click the "Edit colors" button (rightmost or second rightmost button of the tool bar). The "Edit colors" dialog then displays the three (decimal) Red, Green and Blue values. You can convert these to the hexadecimal system (e.g., using the Windows calculator or the HEX2. format in SAS) if needed for a color specification (cxRRGGBB) in SAS or other purposes.
KarolineN
Obsidian | Level 7

Thank you! This is also very useful to know and might come in handy later:)

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 3297 views
  • 7 likes
  • 4 in conversation