//Store the colors
struct cols{
String name;
short code;
};
cols Colors[9] = {
{"white", 0xFFFF},
{"black", 0x0000},
{"red", 0xF800},
{"green", 0x07E0},
{"blue", 0x001F},
{"cyan", 0x07FF},
{"magenta", 0xF81F},
{"yellow", 0xFFE0},
{"orange", 0xFC00}
};
//Function to set Colors
void setColors(String background, String foreground){
for(const cols color: Colors){
if(color.name.equalsIgnoreCase(background)){
carrier.display.fillScreen(color.code);
}
if(color.name.equalsIgnoreCase(foreground)){
carrier.display.setTextColor(color.code);
}
}
}
//Call the function, with the BG first and FG second
setColors("White", "Magenta");
//Change datatype to Short to actually store two bytes
void screenOutput(short background, short foreground, ...) {
carrier.display.fillScreen(background);
carrier.display.setTextColor(foreground);
//...
}
//Call the output as before
ScreenOutput(0xFFFF, 0xF81F);