mglib

Personal IDL library for M. Galloy

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

vis/color/

mg_index2rgb.pro

includes main-level program

Routines

top mg_index2rgb

direct graphics

result = mg_index2rgb(indices [, /hex])

Converts color indices to RGB coordinates. Color indices are long integers used in decomposed color in direct graphics where the lowest order byte value is the red value, the next byte is the green value, the next byte is the blue value, and the highest order byte value is unused.

Return value

bytarr(3) or bytarr(n, 3); string or strarr(n)

Parameters

indices in required type=long or lonarr(n)

indices representing either a color or n colors

Keywords

hex in optional type=boolean

set to return a string instead of a bytarr(3); string formatted according to HTML/CSS conventions: #RRGGBB

Examples

For example:

IDL> print, mg_index2rgb('ffff00'x) 0 255 255
Multiple colors can be converted at once:
IDL> colors = ['ffff00'x, 'ffffff'x, '0000ff'x, 'ff00ff'x] IDL> rgbColors = mg_index2rgb(colors) IDL> print, rgbColors 0 255 255 255 255 255 0 0 255 255 0 255 IDL> tvlct, rgbColors

File attributes

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