About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: 16 July 2008

URL: http://cxc.harvard.edu/chips4.1/concepts/colors.html

Concepts: Colors

Color is an attribute of nearly all objects in ChIPS, and there is a vast palette available. This document describes how to specify color values and how to set the color attributes of objects.

Windows and frames have a background color ("bgcolor"); frames also have a border color attribute. There are "color" properties of many other objects: axes, contours, labels, lines, and points. Regions have an edge color attribute as well as a fill color attribute. The help files for the set_<object> commands list the color attributes for each object.


Specifying Colors

Colors may be specified by name ("lime", "gray", "black") or as hex values (RRGGBB where 0xff0000 = Red, 0x00ff00 = Green, 0x0000ff = Blue). A list of recognized color names is available in the color section of the values concept document.

When using a numerical representation of a color as a string, the 0x prefix is omitted and the string must contain 6 digits (RRGGBB).

# Python
   set_line(["color","fa4812"])
   set_point(["color","blue"])
% S-Lang
   set_line({"color","fa4812"});
   set_point({"color","blue"});

Numerical representations can also be used as integers instead of strings in some contexts.

# Python
   set_line(["color", 255])
   p = ChipsPoint()
   p.color = 0xfa4812
   set_point(p)
% S-Lang
   set_line({"color", 255});
   p = ChipsPoint;
   p.color = 0xfa4812;
   set_point(p);

When colors are represented numerically, the 0x prefix discerns between decimal and hex values.

The default color

ChIPS is designed not only for graphically displaying plots on the screen but also for generating publication-ready hardcopy plots. To facilitate the transition of plots from the screen to paper, ChIPS has foreground and background color preferences for the screen and for postscript output.

foreground.file        : black
background.file        : white
foreground.display     : white
background.display     : black

The default values are black background with white lines in the ChIPS window and the inverse on printout or when saving to a file (white background, black lines).

These default setting can be modified with the set_preferences command (S-Lang or Python help):

# Python
   set_preference("foreground.display", "yellow")
   set_preference("background.display", "navy")
% S-Lang
   set_preference("foreground.display", "yellow");
   set_preference("background.display", "navy");

CMYK Support

CMYK support is provided for postscript and encapsulated postscript output formats. In the print_window command (S-Lang or Python help), specify CMYK ("cmyk") or septed CMYK components ("cmyk_sep"), which creates four output files.

# Python
   print_window("example1", "colorscheme=rgb")
   print_window("example2", "colorscheme=cmyk")
   print_window("example3", "format=ps colorscheme=cmyk_sep")
% S-Lang
   print_window("example1", "colorscheme=rgb");
   print_window("example2", "colorscheme=cmyk");
   print_window("example3", "format=ps colorscheme=cmyk_sep");
Last modified: 16 July 2008


The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.