forked from Galleondragon/qb64
-
Notifications
You must be signed in to change notification settings - Fork 24
$COLOR
Cory Smith edited this page Jun 8, 2022
·
7 revisions
$COLOR is a metacommand that adds named color CONST in a program.
$COLOR:0
$COLOR:32
- $COLOR:0 adds CONST for colors 0-15. The actual constant names can be found in the file source/utilities/color0.bi.
- $COLOR:32 adds CONST for 32-bit colors, similar to HTML color names. The actual constant names can be found in the file source/utilities/color32.bi.
- $COLOR is a shorthand to manually using $INCLUDE pointing to the files listed above.
Red would conflict with _RED, Green would conflict with _GREEN, and Blue would conflict with _BLUE, once the underscore was removed from those commands with $NOPREFIX.
To prevent these conflicts, the COLOR values have had NP_ prepended to the front of them, to distinguish them from the non-prefixed command names. All other color names remain the same, with only the three colors in conflict having to use NP_ (for No Prefix) in front of them.
Example 1: Adding named color constants for SCREEN 0.
$COLOR:0
COLOR BrightWhite, Red
PRINT "Bright white on red."
OutputStartBG4 Bright white on red.
;Example 2:Adding named color constants for 32-bit modes.
```vb
SCREEN _NEWIMAGE(640, 400, 32)
$COLOR:32
COLOR CrayolaGold, DarkCyan
PRINT "CrayolaGold on DarkCyan."
Example 3:Adding named color constants for 32-bit modes (with $NOPREFIX in effect).
SCREEN _NEWIMAGE(640, 400, 32)
$COLOR:32
$NOPREFIX
COLOR NP_Red, White 'notice the NP_ in front of Red?
'This is to distinguish the color from the command with $NOPREFIX.
PRINT "Red on White."