mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

vis/color/

mg_color.pro

includes main-level program

Routines

top mg_color

result = mg_color(colorname [, /names] [, /index] [, /xkcd] [, /crayons])

Get an RGB color value for the specified color name. The available colors are:

Return value

Returns a triple as a bytarr(3) or bytarr(3, n) by default if a single color name or n color names are given. Returns a decomposed color index as a long or lonarr(n) if INDEX keyword is set.

Returns a string array for the names if NAMES keyword is set.

Parameters

colorname in required type=string/strarr

case-insensitive name(s) of the color; note that both "grey" and "gray" are accepted in all names that incorporate them

Keywords

names in optional type=boolean

set to return a string of color names

index in optional type=boolean

set to return a long integer with the RGB decomposed into it

xkcd in optional type=boolean

set to use xkcd color survey color names instead of the HTML color names (see xkcd color survey)

crayons in optional type=boolean

set to use crayon color names instead of the HTML color names

Examples

For example:

IDL> print, mg_color('black') 0 0 0 IDL> print, mg_color('slateblue') 106 90 205 IDL> c = mg_color('slateblue', /index) IDL> print, c, c, format='(I, Z)' 13458026 CD5A6A IDL> print, mg_color(['blue', 'red', 'yellow']) 0 255 255 0 0 255 255 0 0 IDL> print, mg_color(/names) aliceblue antiquewhite aqua aquamarine azure beige ...
These commands are in the main-level example program:
IDL> .run mg_color

Other attributes

Uses:

mg_src_root, mg_index2rgb

File attributes

Modification date: Wed May 14 15:07:15 2014
Lines: 54
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.