olikraus / ucglib

Arduino True Color Library for TFTs and OLEDs
https://github.com/olikraus/ucglib/wiki
Other
261 stars 76 forks source link

setColor with predefined colours ? #146

Closed Greece2 closed 3 years ago

Greece2 commented 3 years ago

Hi, I'm trying to use predefined colours with "setColor". setColor(0,255,255,255); would set the colour to white. Now I've tried to use strutcs to define colours, but without success. Here's an example of what I'm trying:

`// define a struct for RGB colours struct RGB { byte red; byte green; byte blue; };

// predefine colours, assign R, G and B const RGB purple = {255, 65, 12}; // r, g, b const RGB white = {255, 255, 255}; // r, g, b So far, so good. But using ucg.setColor(0, white); // use white as main color for the font` produces the error

no matching function for call to 'Ucglib_ILI9341_18x240x320_HWSPI::setColor(int, const RGB&)'

Guess I'm making a stupid mistake here ?
Any ideas how to solve this ?
Best regards, stay safe !

Greece2 commented 3 years ago

Stupid me, of course I have to "unpack" the struct in this case ... ucg.setColor(0, cyan.red, cyan.green, cyan.blue); Sorry for the question, guess I looked at it too often ;-)