From a24b35c1f7d2ff77d6c2accb9f7d824d2ab85c7d Mon Sep 17 00:00:00 2001 From: lukkass222 Date: Sat, 19 Oct 2024 16:03:22 -0300 Subject: [PATCH 1/3] add invertColors --- TFT_eSPI.cpp | 12 ++++++++++++ TFT_eSPI.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index d537faeb..40273336 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2929,6 +2929,18 @@ void TFT_eSPI::setTextColor(uint16_t c, uint16_t b, bool bgfill) _fillbg = bgfill; } +/*************************************************************************************** +** 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..d1c049e7 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -660,6 +660,8 @@ 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 void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height From 6ffdb46f07c660dbcc3766ea348944eb167181b4 Mon Sep 17 00:00:00 2001 From: lukkass222 Date: Sat, 19 Oct 2024 16:03:57 -0300 Subject: [PATCH 2/3] add getTextColor --- TFT_eSPI.cpp | 8 ++++++++ TFT_eSPI.h | 1 + 2 files changed, 9 insertions(+) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index 40273336..78e9c8ca 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2929,6 +2929,14 @@ 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: invertColors ** Description: Changes foreground and background colors diff --git a/TFT_eSPI.h b/TFT_eSPI.h index d1c049e7..9cdd5830 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -662,6 +662,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac setTextSize(uint8_t size); // Set character size multiplier (this increases pixel size) void invertColors(); //invert textcolor and textbgcolor + uint16_t getTextColor(); //get the textcolor void setTextWrap(bool wrapX, bool wrapY = false); // Turn on/off wrapping of text in TFT width and/or height From 545cac94ccf5cca8902c90a74433a1922648c3c9 Mon Sep 17 00:00:00 2001 From: lukkass222 Date: Sat, 19 Oct 2024 16:04:20 -0300 Subject: [PATCH 3/3] add getTextBgColor --- TFT_eSPI.cpp | 10 ++++++++++ TFT_eSPI.h | 1 + 2 files changed, 11 insertions(+) diff --git a/TFT_eSPI.cpp b/TFT_eSPI.cpp index 78e9c8ca..0c12a009 100644 --- a/TFT_eSPI.cpp +++ b/TFT_eSPI.cpp @@ -2937,6 +2937,16 @@ 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 diff --git a/TFT_eSPI.h b/TFT_eSPI.h index 9cdd5830..eed8a71e 100644 --- a/TFT_eSPI.h +++ b/TFT_eSPI.h @@ -663,6 +663,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac 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