Graphics::setColor

Description

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

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.

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.
  • 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");
}