_BACKGROUNDCOLOR

From QB64 Phoenix Edition Wiki
Revision as of 22:01, 18 April 2022 by SMcNeill (talk | contribs) (Created page with "{{DISPLAYTITLE:_BACKGROUNDCOLOR}} The _BACKGROUNDCOLOR function returns the current background color. {{PageSyntax}} :{{Parameter|BGcolor&}} = _BACKGROUNDCOLOR {{PageDescription}} * Use it to get the current background color to restore later in a program. * Returns the closest attribute value of the background color. {{PageExamples}} ''Example 1:'' Storing a background color for later use. {{CodeStart}} '' '' {{Cl|SCREEN}} 0 {{Cl|COLOR}} 1, 3 {{Cl|CLS}} BG...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The _BACKGROUNDCOLOR function returns the current background color.


Syntax

BGcolor& = _BACKGROUNDCOLOR


Description

  • 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%

Template:BlueStart3 Template:BlueEnd


Example 2: Understanding the function output

  
SCREEN 0
COLOR 1, 11
CLS
BG% = _BACKGROUNDCOLOR
PRINT BG%                  'prints the attribute as 3 instead of 11

Template:BlueStart3 Template:BlueEnd

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