3.5.12.1 Color

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

  • color name
  • RGB triplet
  • HTML hex color code
  • special mapping options

Function Form:

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

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.
d, m Density Color Mapping, mainly for scatter plot
y, m Y Value: Color Mapping, for grouped plot
y, p Y Value: Plus - Minus, for Anomaly Plot
y, t Y Value: Plus - Minus - Total, for Bridge Chart
z, option2 mainly for z colormap waterfall

color(z,m) = Z Value: Color Mapping
color(z,n) = Z Value: Indexing
color(z,r) = Z Value: Direct RGB

index, option2 Plot color from another column. index is offset to the plot, i.e., index = 1 means next column to the plot, index = -1 means the column to the left of the plot.

color(index,m) = Color Mapping
color(index,n) = Indexing
color(index,r) = Direct RGB

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

Example 3

layer.plot1.color = color(y,p)


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.