`prev Menu next`

Color Index ☆

Graphics statements manipulate colors indirectly through color indices, which are nonnegative integers in a certain range.
An arbitrary color can be assigned to any color index.
Color index 0 is a special one, which is the background color.
Graphics statements use color index 1 unless any color index has been specified.
This BASIC allows color indices of from 0 to 255.
Each color index has a pre-defied color as follows.
0 White, 1 Black, 2 Blue, 3 Green, 4 Red, 5 Cyan, 6 Yellow, 7 Magenta, 8 Grey, ... , 15 Silver, ...
Statements
`SET COLOR MIX (Color_Index) red, green, blue`
assigns the color specified by three numeric values that are between 0 and 1 to Color_Index, where Color_Index is a numeric expression.
Example.
`SET COLOR MIX(15) 0,0,1`
assigns blue to the color index 15.
`ASK MAX COLOR m`
Assigns the largest color index to a numeric variable m .
On this version, this value is 255.
`ASK COLOR MIX(color_index) R, G, B`
The red, green, blue strength of the color assigned to color_index is assigned to three numeric variables R, G, B.
Examle.
If the color of index 2 is blue,
`ASK COLOR MIX(2) R,G,B`
assigns 0, 0, 1 to R, G, B, respectively .

Original enhancement
SET … COLOR have the form of
`SET … COLOR "RED"`
Color names are as follows.
`"WHITE", "BLACK", "BLUE", "GREEN", "RED", "CYAN", "MAGENTA", "YELLOW", "GRAY", "SILVER"`
[Note]
Quotation marks must not be omitted.
For example, `SET LINE COLOR RED` means setting line color through a numeric variable RED.
Example 2

     LET color$="BLUE"
     SET POINT COLOR color$