Using an existing color palette
Several objects have a color palette property: the bitmap, the scalar map the contour map, the surface and the GLobject.
You can use one of the palettes installed in Smile. The palettes installed in Smile are located in /More stuff/SmileLabTemplates/Palettes. The More stuff folder may be located either in Smile.app/Contents/Resources/ or in /Home/Library/Application Support/Smile/.
To view a list of those palettes pull down any pen color or fill color menu in the Information window for a graph. To use one of those palettes, provide its name e.g. "Black" as the color palette property.
You can use any palette file even if not installed in Smile. To use such a palette file provide its full path as the color palette property. How to make a new palette file is described below.
You can provide a custom list of colors as the color palette. The list has to be a list of 4n real numbers in the range [0.0, 1.0], with n≤256. Each quadruplet specifies a rgba color (red, green, blue, opacity).
Making a new color palette
To make your own palette, duplicate and rename an existing palette then use the following instructions.
- the Components field is the number of components per individual color: use 3 for {r,g,b}, 4 for {r,g,b,a}, or 1 for gray levels.
- Smile uses internally {r,g,b,a} values in the range [0.0 ... 1.0]. The ComponentsMax field provides the scale of the color components -- usually, 1 or 255.
- the Table field is a comma-separated list of n.Components real or integer numbers, n≤256.
Calculating colors on the fly
When you want to calculate dynamically the color, it is convenient to use the HSV (hue saturation value) scheme (indeed the last parameter is the brightness). With S=1 and V=1, varying H provide the full spectrum: red, green and blue for 0 (or 1), 1/3 and 2/3; yellow, cyan and magenta for 1/6, 1/2 and 5/6. You cannot use directly HSV in Smile: use HSV2RGB to translate a HSV list such as {1/6, 1, 1} into the rgb list, that Smile can use.
|