Skip to main content
HHarj.1
Associate III
February 25, 2020
Solved

Changing wildcard text color?

  • February 25, 2020
  • 2 replies
  • 2659 views

Hi,

I would like to announce measurement results also by text and change the text color based on the results. Green text for a pass, red for failure. How could I do this?

This topic has been closed for replies.
Best answer by Martin KJELDSEN
#include <touchgfx/Color.hpp>
...
textArea.setColor(Color::getColorFrom24BitRGB(0xFF, 0x00, 0x00)); //Red
textArea.setColor(Color::getColorFrom24BitRGB(0x00, 0xFF, 0x00)); //Green
textArea.setColor(Color::getColorFrom24BitRGB(0x00, 0x00, 0xFF)); //Blue

2 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
February 25, 2020
#include <touchgfx/Color.hpp>
...
textArea.setColor(Color::getColorFrom24BitRGB(0xFF, 0x00, 0x00)); //Red
textArea.setColor(Color::getColorFrom24BitRGB(0x00, 0xFF, 0x00)); //Green
textArea.setColor(Color::getColorFrom24BitRGB(0x00, 0x00, 0xFF)); //Blue

Romain DIELEMAN
ST Employee
February 25, 2020

Hi,

the textArea widget has the capability to change the text color.

textArea1.setColor(touchgfx::Color::getColorFrom24BitRGB(255, 0, 0)); //red here

To modify it directly in View you might need to include the path for the color setup (and do not forget to invalidate afterwards as well): #include <touchgfx/Color.hpp>