Introduction
This tutorial discusses a few more functions regarding the colour and size of text on evive’s TFT Display using functions from the TFT library in Arduino IDE, apart from the functions discussed in the tutorial on Getting Started with TFT Display.
TFT Colour
You can change the colour of the text using the following function:
tft.setTextColor(color);
where color can be any of these predefined colors:
- ST7735_BLACK
- ST7735_BLUE
- ST7735_RED
- ST7735_GREEN
- ST7735_CYAN
- ST7735_MAGENTA
- ST7735_YELLOW
- ST7735_WHITE
Apart from this function, other functions can also have these colours in their argument.
Below is an example showing how to change the color of the text on the screen:
Instead of setting colours manually, it is possible to put the responsibility of selecting any random colour on the shoulders of Arduino IDE. It can be done with the help of the function given below:
tft.Color565(uint8_t r, uint8_t g, uint8_t b);
where r, g, b are the red, green and blue value ranging from 0 to 255.
TFT Text Size
You can vary the size of the text using the function shown below:
tft.setTextSize(unit8_t size);
Below is the Arduino sketch showing the use of function for changing the size of the text: