The color of a graphic object is specified by the COLOR property of that object. You can set the color of an object either when the object is created or afterwards. For example, the following statement creates a view object and sets its color value to the RGB triple [60, 60, 60] (a dark gray).
myView = OBJ_NEW('IDLgrView', COLOR = [60, 60, 60])
The following statement changes the color value of an existing axis object to the color value specified for entry 100 in the color palette associated with the axis object.
Remember that color palettes associated with individual graphic atoms are only used when the destination object uses an RGB color model.
RGB values are specified with RGB triples. An RGB triple is a three-element vector of integer values, [r, g, b], generally ranging between 0 and 255. A value of zero is the darkest possible value for each of the three channels-thus an RGB triple of [0, 0, 0] represents black, [0, 255, 0] represents bright green, and [255, 255, 255] represents white.
For example, suppose we create a plot line with the following statements:
myWindow = OBJ_NEW('IDLgrWindow') myView = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[0, 0, 10, 10]) myModel = OBJ_NEW('IDLgrModel') myPlot = OBJ_NEW('IDLgrPlot', FINDGEN(10), THICK = 5, $ COLOR=[255, 255, 255]) myModel->Add, myPlot myView->Add, myModel myWindow->Draw, myView
Notice the following aspects of the above example:
Try changing the colors with the following statements:
myPlot->SetProperty, COLOR = [150, 0, 150] myView->SetProperty, COLOR = [75, 250, 75] myWindow->Draw, myView