b. Setting Screen Background Color

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 09 - Setting Graphics Context >

b. Setting Screen Background Color

This section shows how to change the screen background color using the SetBackgroundcolor() command.

 

 

Command Prototype

 

uint16_t SetBackgroundcolor(uint32_t argb)

 

Parameters

Description

argb

Color values (for example - red, yellow, green etc.)

 

 

Code

 

 

void setup()

{

/* Initialize CleO - needs to be done only once */

 CleO.begin();

 

/* Set background color */

 CleO.SetBackgroundcolor(BLUE);

 

/* Start building a screen frame */

 CleO.Start();

 

 /* Draw string */

 CleO.StringExt(FONT_MEDIUM, 160, 240, YELLOW, MM, 0, 0, "Hello world");

 

 /* Display completed screen frame */

 CleO.Show();

}

 

void loop() {}

 

 

Description

 

The above code snippet uses the SetBackgroundcolor() command to set the screen background color.

You may select a different color by changing the color value in the parameter.

Pre-defined color can be found in the "colornames.h." Alternately, users can also define their ARGB format (for ex:0x00FF00).

 

 

Output

 

Here is the output displayed upon executing the above code snippet -

 

SettingScreenBackgoundColor