BACKGROUNDCOLOR: 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
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_BACKGROUNDCOLOR}} | {{DISPLAYTITLE:_BACKGROUNDCOLOR}} | ||
The | The '''_BACKGROUNDCOLOR''' function returns the current background color for an image handle or page. | ||
{{PageSyntax}} | {{PageSyntax}} | ||
:{{Parameter| | :{{Parameter|col~&}} = [[_BACKGROUNDCOLOR]] [({{Parameter|imageHandle&}})] | ||
Line 10: | Line 10: | ||
* If {{Parameter|imageHandle&}} is omitted, it is assumed to be the current write page or image designated by [[_DEST]]. | * 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. | * If {{Parameter|imageHandle&}} is an invalid handle, an [[ERROR Codes|invalid handle]] error occurs. Check handle values first. Zero designates the current screen. | ||
* Use it to get the current background color to restore later in a program. | * Use it to get the current background 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 '''~&''' symbol), otherwise the blue component may be lost. | |||
{{PageExamples}} | {{PageExamples}} | ||
;Example:Storing the background color for later use. | |||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl|SCREEN}} 0 | {{Cl|SCREEN}} 0 | ||
{{Cl|COLOR}} 1, 3 | {{Cl|COLOR}} 1, 3 'set color 1 as foreground, color 3 as background | ||
{{Cl|CLS}} | {{Cl|CLS}} | ||
col~& = {{Cl|_BACKGROUNDCOLOR}} | |||
{{Cl|PRINT}} | {{Cl|PRINT}} col~& | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{OutputStartBG3}}{{Text|3|#0000aa}} | {{OutputStartBG3}} | ||
{{Text|3|#0000aa}} | |||
{{OutputEnd}} | {{OutputEnd}} | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[_DEFAULTCOLOR]] | * [[_DEFAULTCOLOR]] | ||
* [[COLOR]], [[ | * [[COLOR]], [[_DEST]] | ||
* [[SCREEN (function)]] | * [[SCREEN]], [[SCREEN (function)]] | ||
* [[Windows_Libraries#Color_Dialog_Box|Color Dialog Box]] | * [[Windows_Libraries#Color_Dialog_Box|Color Dialog Box]] | ||
{{PageNavigation}} | {{PageNavigation}} | ||
[[Category:Final]] |
Revision as of 00:37, 14 November 2022
The _BACKGROUNDCOLOR function returns the current background color for an image handle or page.
Syntax
- col~& = _BACKGROUNDCOLOR [(imageHandle&)]
Description
- 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.
- Use it to get the current background 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 ~& symbol), otherwise the blue component may be lost.
Examples
- Example
- Storing the background color for later use.
SCREEN 0 COLOR 1, 3 'set color 1 as foreground, color 3 as background CLS col~& = _BACKGROUNDCOLOR PRINT col~& |
3
|
See also