DEFAULTCOLOR: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{DISPLAYTITLE:_DEFAULTCOLOR}} The _DEFAULTCOLOR function returns the current default text color for an image handle or page. {{PageSyntax}} :{{Parameter|result&}} = _DEFAULTCOLOR [({{Parameter|imageHandle&}})] {{PageDescription}} * If {{Parameter|imageHandle&}} is omitted, it is assumed to be the current write page or image designated by _DEST. * If {{Parameter|imageHandle&}} is an invalid handle, an invalid handle error occurs. Check han...") |
No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_DEFAULTCOLOR}} | {{DISPLAYTITLE:_DEFAULTCOLOR}} | ||
The | The '''_DEFAULTCOLOR''' function returns the current default (text/drawing) color for an image handle or page. | ||
{{PageSyntax}} | {{PageSyntax}} | ||
:{{Parameter| | :{{Parameter|col~&}} = [[_DEFAULTCOLOR]] [({{Parameter|imageHandle&}})] | ||
{{PageParameters}} | |||
* If {{Parameter|imageHandle&}} is omitted, it is assumed to be the current write page or image designated by [[_DEST]]. | |||
* If {{Parameter|imageHandle&}} is an invalid handle, an [[ERROR Codes|Invalid handle]] error occurs. Check handle values first. Zero designates the current screen. | |||
{{PageDescription}} | {{PageDescription}} | ||
* | * Use it to get the current default (foreground) color to restore it later in a program. | ||
* In legacy [[SCREEN]] modes and in [[_NEWIMAGE]] 256 colors mode the color attribute/palette index is returned. | |||
* | * In [[_NEWIMAGE]] 32-bit mode the [[_RGBA32]] value ('''&H00{{Text|00|red}}{{Text|00|green}}{{Text|00|blue}}''' to '''&HFF{{Text|FF|red}}{{Text|FF|green}}{{Text|FF|blue}}''') is returend, make sure to store it in an [[_UNSIGNED]] [[LONG]] variable (as seen in the syntax above with the '''~&''' suffix), otherwise the blue component may be lost. | ||
{{PageExamples}} | {{PageExamples}} | ||
;Example:Storing the default color for later use. The default color is the color set as foreground. | |||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl|SCREEN}} | {{Cl|SCREEN}} {{Text|0|#F580B1}} | ||
{{ | {{Cl|COLOR}} {{Text|4|#F580B1}}, {{Text|7|#F580B1}} {{Text|<nowiki>'set color 4 as foreground, color 7 as background</nowiki>|#919191}} | ||
{{Cl|CLS}} | |||
{{Cl| | col~& = {{Cl|_DEFAULTCOLOR}} | ||
{{Cl| | {{Cl|PRINT}} col~& | ||
{{Cl|PRINT}} | |||
{{CodeEnd}} | {{CodeEnd}} | ||
{{OutputStartBG7}} | |||
{{Text|4|#aa0000}} | |||
{{OutputEnd}} | |||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[ | * [[_BACKGROUNDCOLOR]] | ||
* [[_DEST]] | * [[COLOR]], [[_DEST]] | ||
* [[ | * [[SCREEN]], [[SCREEN (function)]] | ||
* [[ | * [[Windows Libraries#Color_Dialog_Box|Color Dialog Box]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 23:43, 22 March 2023
The _DEFAULTCOLOR function returns the current default (text/drawing) color for an image handle or page.
Syntax
- col~& = _DEFAULTCOLOR [(imageHandle&)]
Parameters
- If imageHandle& is omitted, it is assumed to be the current write page or image designated by _DEST.
- If imageHandle& is an invalid handle, an Invalid handle error occurs. Check handle values first. Zero designates the current screen.
Description
- Use it to get the current default (foreground) color to restore it later in a program.
- In legacy SCREEN modes and in _NEWIMAGE 256 colors mode the color attribute/palette index is returned.
- In _NEWIMAGE 32-bit mode the _RGBA32 value (&H00000000 to &HFFFFFFFF) is returend, make sure to store it in an _UNSIGNED LONG variable (as seen in the syntax above with the ~& suffix), otherwise the blue component may be lost.
Examples
- Example
- Storing the default color for later use. The default color is the color set as foreground.
SCREEN 0 COLOR 4, 7 'set color 4 as foreground, color 7 as background CLS col~& = _DEFAULTCOLOR PRINT col~& |
4
|
See also