I know a lot of folks have enjoyed my color name library for 32-bit colors, so sometime back, I decided to expand the library so that the color names could be used in any screen mode for us, as I'll illustrate below and in the next few posts.
First thing to do, grab the two library files below and put them in your QB64 library.
Next, be aware that the library now makes use of QB64's precompiler, so you'll need to set a precompiler value to tell it which screen mode your program is going to be working with. The variable for this is simply called KOLOR.
So, for a text screen (SCREEN 0) program, all you'd need to do is basically set KOLOR to 0 (to indicate it's going to be SCREEN 0 text graphics), and then include the ColorAll.BI at the top of your program, and then you can use the color names instead of the numbers for your program -- as indicated below.
'First, set the KOLOR value to tell the precompiler what color scheme we need.
'Then include the library file.
'$include:'ColorAll.BI'
'Then use the names
COLOR BrightWhite
, Yellow
PRINT "Bright White on Yellow" COLOR Blink
+ BrightWhite
, Magenta
PRINT "Blink Bright White on Magenta"
Color values can be read by looking at the variables inside ColorAll.BI, but for simplicity's sake, I'll include them here since there's only a few to deal with in text mode:
$IF KOLOR = 0 THEN
CONST Black = 0~%%
CONST Blue = 1~%%
CONST Green = 2~%%
CONST Cyan = 3~%%
CONST Red = 4~%%
CONST Magenta = 5~%%
CONST Brown = 6~%%
CONST White = 7~%%
CONST Gray = 8~%%
CONST LightBlue = 9~%%
CONST LightGreen = 10~%%
CONST LightCyan = 11~%%
CONST LightRed = 12~%%
CONST LightMagenta = 13~%%
CONST Yellow = 14~%%
CONST BrightWhite = 15~%%
CONST Blink = 16~%%
$END IF