BACKGROUNDCOLOR: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
m (Removed protection from "BACKGROUNDCOLOR")
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:_BACKGROUNDCOLOR}}
{{DISPLAYTITLE:_BACKGROUNDCOLOR}}
The [[_BACKGROUNDCOLOR]] function returns the current background color.
The [[_BACKGROUNDCOLOR]] function returns the current background color for an image handle or page.




{{PageSyntax}}
{{PageSyntax}}
:{{Parameter|BGcolor&}} = [[_BACKGROUNDCOLOR]]
:{{Parameter|result&}} = [[_BACKGROUNDCOLOR]] [({{Parameter|imageHandle&}})]
 




{{PageDescription}}
{{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 [[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 later in a program.
* Returns the closest attribute value of the background color.
* Returns the closest attribute value of the background color.

Revision as of 08:09, 30 September 2022

The _BACKGROUNDCOLOR function returns the current background color for an image handle or page.


Syntax

result& = _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 later in a program.
  • Returns the closest attribute value of the background color.


Examples

Example 1: Storing a background color for later use.

  
SCREEN 0
COLOR 1, 3
CLS
BG% = _BACKGROUNDCOLOR
PRINT BG%
3


Example 2: Understanding the function output

  
SCREEN 0
COLOR 1, 11
CLS
BG% = _BACKGROUNDCOLOR
PRINT BG%                  'prints the attribute as 3 instead of 11
3
Explanation: SCREEN 0 background colors over 7 will return the lower intensity color attribute values: EX: attribute - 8


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link