Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

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


top cgCOLOR24

Graphics, Utilities

result = cgCOLOR24(color)

The purpose of this function is to convert a RGB color triple into the equivalent 24-bit long integer. The 24-bit integer can be decomposed into the appropriate color by interpreting the lowest 8 bits as red, the middle 8 bits as green, and the highest 8 bits as blue. This routine was written to be used with device-independent color programs like cgColor.

Return value

A 24-bit long integer that can be decomposed into a color triple value.


color in required

A three-element column or row array representing a color triple. Or an N-by-three element array of color triples. The values of the elements must be between 0 and 255.


To convert the color triple for the color YELLOW, (255, 255, 0), to the hexadecimal value '00FFFF'x or the decimal number 65535, type:

color = COLOR24([255, 255, 0])

Author information



David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: Coyote's Guide to IDL Programming:


Copyright (c) 1996-2012, Fanning Software Consulting, Inc.


Change History:

Written by: David Fanning, 3 February 96. Completely revised the algorithm to accept color arrays. 19 October 2000. DWF.

File attributes

Modification date: Fri Mar 27 11:07:37 2015
Lines: 98
Docformat: rst rst