gb.createColor

Description

Color gb.createColor( uint8_t red , uint8_t green , uint8_t blue )

gb.createColor creates a variable of type Color based on common RGB values.

Parameters

  • uint8_t red: proportion of red (0: min, 255: max)
  • uint8_t green: proportion of green (0: min, 255: max)
  • uint8_t blue: proportion of blue (0:min, 255: max)

Returns

Color: the RGB565 color which is closest to the one provided

Example

#include <Gamebuino-Meta.h>

void setup() {
  gb.begin();
}

void loop() {
  if (gb.update()) {
    gb.display.clear();

    // create the color (#FFC526, some shade of orange)
    Color c = gb.createColor(255, 197, 38);
    gb.display.setColor(c);
    gb.display.println("Hello World");
  }
}