|
1 |
| -# $COLOR |
2 |
| - |
3 |
| -**$COLOR** is a metacommand that adds named color constants into a program, which then can be used instead of hardcoded literal color values. |
4 |
| - |
5 |
| - |
6 |
| - |
7 |
| -## Syntax |
8 |
| - |
9 |
| -$COLOR**:**{0|32} |
10 |
| - |
11 |
| - |
12 |
| -## Parameters |
| 1 | +## $COLOR |
| 2 | +--- |
13 | 3 |
|
14 |
| -* The one and only parameter is a literal number designating either to include [SCREEN 0](SCREEN 0.md) based color indexes, or full [_RGB32](_RGB32.md) color values with full (opaque) alpha. |
| 4 | +### $COLOR is a metacommand that adds named color constants into a program, which then can be used instead of hardcoded literal color values. |
15 | 5 |
|
16 |
| - |
| 6 | +#### SYNTAX |
17 | 7 |
|
18 |
| -## Description |
| 8 | +`$COLOR : {0|32}` |
19 | 9 |
|
20 |
| -* **$COLOR:0** adds constants for the colors 0-15 available in **SCREEN 0**, these do also match for the first 16 colors on 8-Bit (256 colors) graphic screens as long as they are not changed using [PALETTE](PALETTE.md) or [_PALETTECOLOR](_PALETTECOLOR.md). For the actual constant names see [$COLOR:0 Name Table]($COLOR:0 Name Table.md). |
21 |
| -* **$COLOR:32** adds constants for full 32-Bit color values as used on 32-Bit screens created via [_NEWIMAGE](_NEWIMAGE.md), similar to HTML color names. For the actual constant names see [$COLOR:32 Name Table]($COLOR:32 Name Table.md). |
22 |
| -* Prior to QB64-PE v0.5.0, **$COLOR** was not compatible with [$NOPREFIX]($NOPREFIX.md). |
23 |
| -* Since QB64-PE v0.5.0, **$COLOR** can now be used with [$NOPREFIX]($NOPREFIX.md), with a few notable differences to three conflicting colors -- Red, Green, Blue. |
| 10 | +#### PARAMETERS |
| 11 | +* The one and only parameter is a literal number designating either to include [SCREEN](./SCREEN.md) 0 based color indexes, or full [_RGB32](./_RGB32.md) color values with full (opaque) alpha. |
24 | 12 |
|
25 |
| -Red would conflict with [_RED](_RED.md), Green would conflict with [_GREEN](_GREEN.md), and Blue would conflict with [_BLUE](_BLUE.md), once the underscore was removed from those commands with [$NOPREFIX]($NOPREFIX.md). |
26 | 13 |
|
27 |
| -To prevent these conflicts, the [COLOR](COLOR.md) 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 **N**o **P**refix) in front of them. |
28 |
| - |
| 14 | +#### DESCRIPTION |
| 15 | +* $[COLOR](./COLOR.md):0 adds constants for the colors 0-15 available in [SCREEN](./SCREEN.md) 0 , these do also match for the first 16 colors on 8-Bit (256 colors) graphic screens as long as they are not changed using [PALETTE](./PALETTE.md) or [_PALETTECOLOR](./_PALETTECOLOR.md) . For the actual constant names see $[COLOR](./COLOR.md):0 Name Table . |
| 16 | +* $[COLOR](./COLOR.md):32 adds constants for full 32-Bit color values as used on 32-Bit screens created via [_NEWIMAGE](./_NEWIMAGE.md) , similar to HTML color names. For the actual constant names see $[COLOR](./COLOR.md):32 Name Table . |
| 17 | +* Prior to QB64-PE v0.5.0, $[COLOR](./COLOR.md) was not compatible with $NOPREFIX . |
| 18 | +* Since QB64-PE v0.5.0, $[COLOR](./COLOR.md) can now be used with $NOPREFIX , with a few notable differences to three conflicting colors -- Red, Green, Blue. |
29 | 19 |
|
30 |
| -## Examples |
31 | 20 |
|
32 |
| -Example 1 |
33 |
| -Adding named color constants for SCREEN 0. |
| 21 | +#### EXAMPLES |
| 22 | +```vb |
| 23 | +$COLOR:0 |
34 | 24 |
|
35 |
| -``` $COLOR:0 [COLOR](COLOR.md) BrightWhite, Red [PRINT](PRINT.md) "Bright white on red." |
| 25 | +COLOR BrightWhite, Red |
| 26 | +PRINT "Bright white on red." |
36 | 27 | ```
|
37 |
| - |
38 |
| -``` Bright white on red. |
| 28 | + |
| 29 | +```vb |
| 30 | +Bright white on red. |
39 | 31 | ```
|
| 32 | + |
| 33 | +```vb |
| 34 | +SCREEN _NEWIMAGE(640, 400, 32) |
| 35 | +$COLOR:32 |
40 | 36 |
|
41 |
| ---- |
42 |
| - |
43 |
| -Example 2 |
44 |
| -Adding named color constants for 32-bit modes. |
45 |
| - |
46 |
| -``` [SCREEN](SCREEN.md) [_NEWIMAGE](_NEWIMAGE.md)(640, 400, 32) $COLOR:32 [COLOR](COLOR.md) CrayolaGold, DarkCyan [PRINT](PRINT.md) "CrayolaGold on DarkCyan." |
| 37 | +COLOR CrayolaGold, DarkCyan |
| 38 | +PRINT "CrayolaGold on DarkCyan." |
47 | 39 | ```
|
48 |
| - |
49 |
| -``` CrayolaGold on DarkCyan. |
| 40 | + |
| 41 | +```vb |
| 42 | +CrayolaGold on DarkCyan. |
50 | 43 | ```
|
| 44 | + |
| 45 | +```vb |
| 46 | +$NOPREFIX |
51 | 47 |
|
52 |
| ---- |
53 |
| - |
54 |
| -Example 3 |
55 |
| -Adding named color constants for 32-bit modes (with $NOPREFIX in effect). |
| 48 | +SCREEN NEWIMAGE(640, 400, 32) |
| 49 | +$COLOR:32 |
56 | 50 |
|
57 |
| -``` [$NOPREFIX]($NOPREFIX.md) [SCREEN](SCREEN.md) [NEWIMAGE](NEWIMAGE.md)(640, 400, 32) $COLOR:32 [COLOR](COLOR.md) NP_Red, White 'notice the NP_ in front of Red? 'This is to distinguish the color from the command with $NOPREFIX. [PRINT](PRINT.md) "Red on White." |
| 51 | +COLOR NP_Red, White 'notice the NP_ in front of Red? |
| 52 | +'This is to distinguish the color from the command with $NOPREFIX. |
| 53 | +PRINT "Red on White." |
58 | 54 | ```
|
59 |
| - |
60 |
| -``` Red on White. |
| 55 | + |
| 56 | +```vb |
| 57 | +Red on White. |
61 | 58 | ```
|
62 |
| - |
63 | 59 |
|
64 | 60 |
|
65 |
| -## See also |
66 |
| - |
67 |
| -* [COLOR](COLOR.md) |
68 |
| -* [SCREEN](SCREEN.md), [_NEWIMAGE](_NEWIMAGE.md) |
69 |
| -* [Metacommand](Metacommand.md) |
70 |
| -* [$COLOR:0 Name Table]($COLOR:0 Name Table.md) |
71 |
| -* [$COLOR:32 Name Table]($COLOR:32 Name Table.md) |
72 | 61 |
|
73 |
| - |
| 62 | +#### SEE ALSO |
| 63 | +* [COLOR](./COLOR.md) |
| 64 | +* [SCREEN](./SCREEN.md) , [_NEWIMAGE](./_NEWIMAGE.md) |
| 65 | +* Metacommand |
| 66 | +* $[COLOR](./COLOR.md):0 Name Table |
| 67 | +* $[COLOR](./COLOR.md):32 Name Table |
0 commit comments