QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _BACKGROUNDCOLOR function returns the current background color.

Syntax

BGcolor& = _BACKGROUNDCOLOR

Description

Example(s)

Storing a background color for later use.


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

3

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