diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index d537faeb..0c12a009 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2929,6 +2929,36 @@ void TFT_eSPI::setTextColor(uint16_t c, uint16_t b, bool bgfill) _fillbg = bgfill; } +/*************************************************************************************** +** Function name: getTextColor +** Description: get the font foreground colour +***************************************************************************************/ +uint16_t TFT_eSPI::getTextColor() +{ + return textcolor; +} + +/*************************************************************************************** +** Function name: getTextBgColor +** Description: get the font background colour +***************************************************************************************/ +uint16_t TFT_eSPI::getTextBgColor() +{ + return textbgcolor; +} + +/*************************************************************************************** +** Function name: invertColors +** Description: Changes foreground and background colors +***************************************************************************************/ +void TFT_eSPI::invertColors() +{ + uint16_t cor = textcolor; + + textcolor = textbgcolor; + textbgcolor = cor; + +} /*************************************************************************************** ** Function name: setPivot diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 8ae23427..eed8a71e 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -660,6 +660,10 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac void setTextColor(uint16_t color), // Set character (glyph) color only (background not over-written) setTextColor(uint16_t fgcolor, uint16_t bgcolor, bool bgfill = false), // Set character (glyph) foreground and background colour, optional background fill for smooth fonts setTextSize(uint8_t size); // Set character size multiplier (this increases pixel size) + + void invertColors(); //invert textcolor and textbgcolor + uint16_t getTextColor(); //get the textcolor + uint16_t getTextBgColor(); //get the textbgcolor void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height