TTF_SetTextColor(3)
π TTF_SetTextColor(3) π
okay bestie, welcome to the SDL_ttf3 FUNCTIONS corner of the group chat, where we make text go from "meh, white" to "main character in every colour" π β¨
π NAME π
TTF_SetTextColor</p> β set the color of a text object. literally that. that's the whole job. and she does it beautifully. π
π HEADER FILE π
Defined in SDL3_ttf/SDL_ttf.h β go get your include, bestie, she's right there π«Ά
β¨ SYNOPSIS β¨
#include "SDL3_ttf/SDL_ttf.h"
bool TTF_SetTextColor(TTF_Text *text, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
four little numbers and a dream, no cap πΈ
π DESCRIPTION π
so here's the tea: the default text color is white (255, 255, 255, 255). which is fine, she's a classic, she ate. but if you want your text to be giving something more? that's what this function is for, bestie. red, green, blue, and alpha, all in one go. π¨
πΈ FUNCTION PARAMETERS πΈ
textβ theTTF_Textto modify. your text object. the one you're about to glow up. πrβ the red color value in the range of0-255. π΄gβ the green color value in the range of0-255. π’bβ the blue color value in the range of0-255. π΅aβ the alpha value in the range of0-255. π» (that's the transparency vibe check, iykyk)
π RETURN VALUE π
Returns true on success or false on failure. and if she says false? not me crying. π call SDL_GetError() for more information β she will tell you what went wrong, fr fr.
π§΅ THREAD SAFETY π§΅
This function should be called on the thread that created the text. periodt. don't be out here calling her from some random thread, that's not the vibe π«
β AVAILABILITY β
This function is available since SDL_ttf 3.0.0. she's been iconic since day one, no notes π
π₯ SEE ALSO π₯
β’(3)TTF_GetTextColor(3)β’(3)TTF_SetTextColorFloat(3)
(yes, the bullets are real, yes they're just like that, we don't ask questions, we love her anyway π¦)
and that's the whole page, bestie!! π«Ά this lil slice of SDL_ttf is brought to you by SDL_ttf 3.2.2, straight from the SDL_ttf crew β go set some colors, you absolute icon β¨ππππ
π¦ where this page comes from
- debian trixie: libsdl3-ttf-doc 3.2.2+ds-1 Β· Zlib
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 43: SDL3_ttf-devel 3.2.2-2.fc43 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- fedora 44: SDL3_ttf-devel 3.2.2-4.fc44 Β· Zlib AND MIT
- ubuntu questing: libsdl3-ttf-doc 3.2.2+ds-1
- ubuntu resolute: libsdl3-ttf-doc 3.2.2+ds-1build1 Β· Zlib
- ubuntu stonking: libsdl3-ttf-doc 3.2.2+ds-2 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms