Graphics::setColor

Description

void Graphics::setColor( Color | ColorIndex | uint8_t color [, Color | ColorIndex | uint8_t bgColor ] )
void Graphics::setColor( uint8_t r , uint8_t g , uint8_t b )

Graphics::setColor will set the current drawing color. You can also specify a background color. If none is specified the background color will be transparent. This is used for things like drawing text, setting pixels etc. You can also specify your own RGB values you want to use.

IMPORTANT!!! Colors are static, meaning that if you change the color on gb.light it will also change on gb.display etc.!

Parameters

  • Color | ColorIndex | uint8_t color: the color to set to
  • Color | ColorIndex | uint8_t gColor (optional): the background color to set to.
  • Instead of the above: uint8_t r, g, b the RGB values of the color to set to.
  • You can use the following default colors. For more info see Color Palettes.
WHITE
GRAY
DARKGRAY
BLACK
PURPLE
PINK
RED
ORANGE
BROWN
BEIGE
YELLOW
LIGHTGREEN
GREEN
DARKBLUE
BLUE
LIGHTBLUE

Returns

none

Example

#include <Gamebuino-Meta.h>

void setup() { gb.begin(); } void loop() { while(!gb.update()); gb.clear(); // set the color to draw gb.display.setColor(RED); gb.display.println("Red text"); }