BASIC Palette Statements and Functions - fvdhoef/aquarius-plus GitHub Wiki
TYPE: plusBASIC graphics statement
FORMAT: DEF RGBLIST var$ = rgb_values
Action: Creates an RGB color list.
- var$ is a simple string variable.
-
rgb_values is a series of semi-colon separated RGB triplets.
- Each RGB triplet is a red, green, and blue value separated with commas.
Example:
DEF RGBLIST R$ = 15,0,0; 0,15,0; 0,0,15
Creates an RGB color list consisting of the colors red, green, and blue.
TYPE: plusBASIC disk statement
FORMAT: LOAD PALETTE palette , filespec
Action: Loads palette definition from SD card and writes it to palette.
- palette is the palette number to be loaded (see SET PALETTE).
- filespec is a string expression containing an optional path and the full file name.
-
File not found error
results if the specified file does not exist. -
Overflow error
results if the file length is not exactly 32 or 64 bytes.
Example:
LOAD PALETTE 0,"grayscale.pal"
Reads file
grayscale.pal
and writes contents to palette 0.
FORMAT: LOAD PALETTE palette , filespec , ASC
Action: As above, but reads an ASCII text files containing six-digit RGB hex values.
File format:
- The file must contain multiple lines of ASCII text.
- Any lines matching one of the following formats is parsed as an RGB value:
- Lines starting with
#
(as of v0.23c) or$
(as of v0.27b).-
Bad file error
occurs if such line is less than 7 characters long or characters 2 through 7 are not hexadecimal digits. - Any characters after the six-digit hexadecimal value are ignored.
-
- Lines exactly 6 characters long (as of v0.27b).
-
Bad file error
occurs if the line contains any characters that are not hexadecimal digits.
-
- Lines exactly 8 characters long beginning with hex digits
FF
(as of v0.27b).-
Bad file error
occurs if the rest of characters that are not hexadecimal digits.
-
- Lines starting with
- All other lines are ignored.
-
Bad file error
occurs if the number of RGB values parsed is not exactly 32.
FORMAT: LOAD PALETTE palette , filespec , HEX
Action: As above, but reads a file containing a 64 character hex string.
-
Bad file error
occurs if the file is not exactly 64 bytes long or contains any non hex-digit characters.
TYPE: plusBASIC graphics statement
FORMAT: SET PALETTE palette TO rgb_list
Action: Sets one or more palette entries to the specified colors.
-
palette is the palette to modify (0 through 3).
- Screen 0 (text) always uses palette 0.
- Screen 1 (bitmap) always uses palette 1.
-
Illegal quantity
results if palette is not between 0 and 3.
-
rgb_list is a string of RGB values created with the
DEF RGBLIST
statement.
Example:
DEF RGBLIST W$ = 15,15,15
SET PALETTE 0 TO W$
Sets the first index of palette 0 to white, changing text screen color 0 from black to white.
DEF RGBLIST B$ = 0,0,0
SET PALETTE 0 TO B$
Sets the first index of palette 0 to black, changing text screen color 0 back to black.
DEF RGBLIST P$ = 0,0,0; 0,0,$F; 0,$F,0; 0,$F,$F; $F,0,0; $F,0,$F; $F,$F,0; $F,$F,$F
SET PALETTE 1 TO P$
Sets the first eight bitmap colors to black, blue, green, cyan, red, magenta, yellow, and white.
DEF RGBLIST G$ = 0,0,0; 1,1,1; 2,2,2; 3,3,3; 4,4,4; 5,5,5; 6,6,6; 7,7,7; 8,8,8; 9,9,9; 10,10,10; 11,11,11; 12,12,12; 13,13,13; 14,14,14; 15,15,15
SET PALETTE 0 TO G$
Sets the text screen colors to shades of gray.
FORMAT: SET PALETTE palette INDEX index TO rgb_values
Action: As above, but entries are set starting at the specified index.
Example:
SET PALETTE 0 INDEX 6 TO RGB$(15,15,15)
Sets color entry 6 of palette 0 to white, changing text color 6 from cyan to white.
DEF RGBLIST P$ = 0,0,0; 0,0,$F; 0,$F,0; 0,$F,$F; $F,0,0; $F,0,$F; $F,$F,0; $F,$F,$F
SET PALETTE 1 INDEX 8 TO P$
Sets the last eight bitmap colors to black, blue, green, cyan, red, magenta, yellow, and white.
TYPE: plusBASIC graphics statement
FORMAT: RESET PALETTE palette
Action: Sets the specified palette to the default palette
-
palette is the palette to modify (0 through 3).
-
Illegal quantity
results if palette is not between 0 and 3.
-
TYPE: plusBASIC graphics function
FORMAT: RGB( red , green , blue )
Action: Returns an integer representing a single RGB palette entry.
- red, green, and blue are integer expressions specifying the intensity of each primary color.
- Illegal quantity results if any argument is not in the range 0 through 15.
Example:
RGB(0,0,0)
Returns 0 (black)
RGB$(15,15,15)
Returns 4095 (white)
TYPE: plusBASIC graphics function
FORMAT: RGB$( red , green , blue )
Action: Returns a two-byte binary string containing a single RGB palette entry.
- red, green, and blue are integer expressions specifying the intensity of each primary color.
- Illegal quantity results if any argument is not in the range 0 through 15.
Example:
RGB$(0,0,0)
Returns an RGB$ string representing the color black.
RGB$(15,15,15)
Returns an RGB$ string representing the color white.
Index | RGB | Color | Index | RGB | Color |
---|---|---|---|---|---|
0 | 111 | Black | 8 | CCC | Grey |
1 | F11 | Red | 9 | 3BB | Dark Cyan |
2 | 1F1 | Green | 10 | C2C | Dark Magenta |
3 | FF1 | Yellow | 11 | 419 | Dark Blue |
4 | 22E | Blue | 12 | FF7 | Light Yellow |
5 | F1F | Magenta | 13 | 2D4 | Dark green |
6 | 3CC | Cyan | 14 | B22 | Dark red |
7 | FFF | White | 15 | 333 | Dark grey |