Color

The color() function returns an internal color code and accepts three forms of syntax:

Contents

Function Form:

 Color(name)
 color(name,0)
 Color(html)
 color(r,g,b)

Arguments:

Argument Description
name Name of the color, from LabTalk:List of Colors:

Black, Red, Green, Blue, Cyan, Magenta, Yellow, DarkYellow, Navy, Purple, Wine, Olive, DarkCyan, Royal, Orange, Violet, Pink, White, LTGray, Gray, LTYellow, LTCyan, LTMagenta, DarkGray

name,0 Name of the color, 0 (for zero-based index)

LabTalk and OriginC use different indexing for numerous objects, including row numbers, column numbers and color indexes to name three. Labtalk indexes are generally enumerated from 1, while OriginC indexes are generally enumerated from 0. When you pass a color index from LabTalk to OriginC or X-Function, you have to keep this in mind. These examples are functionally equivalent

iColor = color(olive); return = MyOriginCFunction(iColor-1);
iColor = color(olive,0); return = MyOriginCFunction(iColor);
html HTML standard color code. The following examples produce LightSalmon, Red and Pink, respectively.

"#FFA07A"
"#F00"
"#FFC0CB"

Note: When using HTML color codes in your LabTalk scripts, be sure to surround color codes with double quotes since the pound sign (#) is a comment character in LabTalk.

r, g, b Triplet values, r, g, and b correspond to Red, Green, and Blue in RGB color scheme, and each component value ranges from 0 to 255.

Examples:

Example 1

cnum=color(green);
cnum=;
==>CNUM=3 // index number of green in LabTalk list of colors

Example 2

set %c -cl color("#008800"); // set plot line color to dark green
set %c -cse color(255,133,0); // set plot symbol edge color to orange

See Also:

Selection -c for the object color.

Get {-c, -cl, etc.} to get the plot color.

Set {-c, -cl, etc.} to set the plot color.

LabTalk List of Colors.