The color() function accepts various color-related values as arguments and returns an internal color code; or in the case of color(r,g,b,1), returns an RGB decimal.

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

Function Form:

 color(colorlist, index)


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.


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. When used with the r, g, b arguments only (see next), the color function returns an internal color value.
r, g, b, 1 The "1" argument forces the color function to return an RGB decimal value instead of Origin's internal color value (see previous).
r, g, b, 2 converting Red color in high byte.
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

colorlist, index built-in or user-defined color list, 1-based index
pick specified color from color list
Color("candy1.oth", 1) //pick 1st color in Candy1 color list


Example 1

==>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

==> CNUM=16974337

Example 4

@gc=color(0,255,0,1); // set graph page layer grid color to green.

Example 5

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

Example 6

color(157,29,29,2) =;// 10296605 = #9D1D1D
color(157,29,29,1) =;// 1908125 = #1D1D9D

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.