mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-07 08:20:18 +00:00
Note: Many files were removed (not yet existing/empty pages). The parser will try to download them on demand and will auto-generate text for missing pages (eg. most _gl pages).
61 lines
2.2 KiB
Text
61 lines
2.2 KiB
Text
{{QBDLDATE:05-20-2022}}
|
|
{{QBDLTIME:23:07:06}}
|
|
[[$COLOR]] is a metacommand that adds named color [[CONST|constants]] in a program.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: [[$COLOR]]:0
|
|
: [[$COLOR]]:32
|
|
|
|
|
|
{{PageDescription}}
|
|
* [[$COLOR]]:0 adds [[CONST|constants]] for colors 0-15. The actual constant names can be found in the file '''source/utilities/color0.bi'''.
|
|
* [[$COLOR]]:32 adds [[CONST|constants]] 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.
|
|
* Prior to QBPE v0.5 (ü), [[$COLOR]] was not compatible with [[$NOPREFIX]].
|
|
* Since QBPE v0.5, [[$COLOR]] can now be used with [[$NOPREFIX]], with a few notable differences to three conflicting colors -- Red, Green, Blue.
|
|
|
|
: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 '''N'''o '''P'''refix) in front of them.
|
|
(ü) QBPE = QB64 Phoenix Edition
|
|
|
|
|
|
{{PageExamples}}
|
|
;Example 1:Adding named color constants for SCREEN 0.
|
|
{{CodeStart}}
|
|
{{Cl|$COLOR}}:0
|
|
{{Cl|COLOR}} BrightWhite, Red
|
|
{{Cl|PRINT}} "Bright white on red."
|
|
{{CodeEnd}}
|
|
{{OutputStartBG4}}
|
|
{{Text|Bright white on red.|#fcfcfc}}
|
|
{{OutputEnd}}
|
|
|
|
;Example 2:Adding named color constants for 32-bit modes.
|
|
{{CodeStart}}
|
|
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(640, 400, 32)
|
|
{{Cl|$COLOR}}:32
|
|
{{Cl|COLOR}} CrayolaGold, DarkCyan
|
|
{{Cl|PRINT}} "CrayolaGold on DarkCyan."
|
|
{{CodeEnd}}
|
|
|
|
;Example 3:Adding named color constants for 32-bit modes (with $NOPREFIX in effect).
|
|
{{CodeStart}}
|
|
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(640, 400, 32)
|
|
{{Cl|$COLOR}}:32
|
|
{{Cl|$NOPREFIX}}
|
|
{{Cl|COLOR}} NP_Red, White 'notice the NP_ in front of Red?
|
|
'This is to distinguish the color from the command with $NOPREFIX.
|
|
{{Cl|PRINT}} "Red on White."
|
|
{{CodeEnd}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[COLOR]], [[SCREEN]]
|
|
* [[_NEWIMAGE]], [[$INCLUDE]]
|
|
* [[Metacommand]]
|
|
|
|
|
|
{{PageNavigation}}
|
|
|