Converts a color number to a string.
String_Type chips_color_name([colorValue])
Returns the string equivalent of the symbolic color values
in the "_chips" namespace. The values are described in the
'Attribute values' section of "ahelp chips".
The "chips_color_value()" function can be used to
convert the names of colors to their symbolic value.
Arguments for chips_color_name
colorValue |
Integer_Type |
black, blue, cyan, default,
green, magenta, red,
white, yellow (see Example 3) |
default |
Optional |
If colorValue is outside the range of supported colors,
then the string "default" will be returned.
If the color value is
omitted the routine will return a string containing
all the available colors, separated by a newline
(i.e. '\n') character.
chips> chips_color_name( _chips->red )
red
Here we convert the value _chips->red to the
string "red". Since we have ignored the return value,
ChIPS prints it out to the screen (see the
'Using ChIPS and Sherpa as a calculator' section
of "ahelp tips").
chips> variable colname = chips_color_name( chips.curvecolor );
chips> print("The color of curves is " + colname );
Here use use S-Lang code to find out the name of
the color used to draw curves. If the ChIPS
state object has not been changed, then
these commands would produce the following output:
The color of curves is default
chips> chips_color_name()
black
blue
cyan
default
green
magenta
red
white
yellow
Since no value is given, the list of available
colors is returned. This string may be stored in a variable:
chips> hues = chips_color_name()
chips> print(hues)
black
blue
cyan
default
green
magenta
red
white
yellow
As the names are separated by
the newline ('\n') character, they can be easily
separated using the S-Lang strchop() function:
chips> colors = strchop( chips_color_name(), '\n', 0 )
chips> print(colors[2])
cyan
- chips
-
chips_auto_redraw,
chips_clear,
chips_color_value,
chips_get_pane,
chips_get_xrange,
chips_get_xscale,
chips_get_yrange,
chips_get_yscale,
chips_get_zrange,
chips_get_zscale,
chips_label,
chips_line,
chips_pickpoints,
chips_redraw,
chips_set_pane,
chips_set_xrange,
chips_set_xscale,
chips_set_yrange,
chips_set_yscale,
chips_set_zrange,
chips_set_zscale,
chips_split,
chips_version
|