TTF_GetTextColor(3)

πŸ’– TTF_GetTextColor(3) πŸ’–

okay bestie, welcome to the SDL_ttf3 FUNCTIONS corner of the manual, and today's main character is TTF_GetTextColor ✨


🌸 NAME 🌸

TTF_GetTextColor β€” get the color of a text object, no cap 🎨


πŸŽ€ HEADER FILE πŸŽ€

Defined in SDL3_ttf/SDL_ttf.h


✨ SYNOPSIS ✨

#include "SDL3_ttf/SDL_ttf.h"

bool TTF_GetTextColor(TTF_Text *text, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);

🫢 FUNCTION PARAMETERS 🫢

  • text β€” the TTF_Text you wanna query, like, the actual text object in question πŸ’…
  • r β€” a pointer that gets filled in with the red color value, range 0-255, and it may be NULL (yes, you can just not care about red, she's optional)
  • g β€” a pointer that gets filled in with the green color value, range 0-255, may be NULL too πŸ“
  • b β€” a pointer that gets filled in with the blue color value, range 0-255, may be NULL as well πŸ¦‹
  • a β€” a pointer that gets filled in with the alpha value, range 0-255, and yep, may be NULL πŸ™ˆ

like, you can pass NULL for any of the color channels you don't gaf about. iconic behavior honestly.


πŸ‘‘ RETURN VALUE πŸ‘‘

Returns true on success or false on failure πŸ’€ and if it fails, call SDL_GetError() for more information, that's where the tea is.


🧚 THREAD SAFETY 🧚

This function should be called on the thread that created the text. like, stay loyal to your thread bestie, don't be out here calling it from a random one 😭


⭐ AVAILABILITY ⭐

This function is available since SDL_ttf 3.0.0 ✨ so if you're on anything older... not me finding out the hard way.


🌈 SEE ALSO 🌈


lowkey reminder: the r, g, b, a pointers all get values in the range 0-255, and every single one of them may be NULL. don't forget it, bestie πŸ’œ

sign-off time πŸŽ€ this page is from SDL_ttf, version SDL_ttf 3.2.2, and it's giving TTF_GetTextColor(3) energy. go forth and get those colors, you ate πŸ’…βœ¨

πŸ“¦ where this page comes from