_BACKGROUNDCOLOR

From QB64 Phoenix Edition Wiki
Revision as of 16:19, 19 March 2023 by RhoSigma (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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


Syntax

col~& = _BACKGROUNDCOLOR [(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 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 ~& suffix), 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



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