ttfSetTextColor function

bool ttfSetTextColor(
  1. Pointer<TtfText> text,
  2. int r,
  3. int g,
  4. int b,
  5. int a,
)

Set the color of a text object.

The default text color is white (255, 255, 255, 255).

\param text the TTF_Text to modify. \param r the red color value in the range of 0-255. \param g the green color value in the range of 0-255. \param b the blue color value in the range of 0-255. \param a the alpha value in the range of 0-255. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should be called on the thread that created the text.

\since This function is available since SDL_ttf 3.0.0.

\sa TTF_GetTextColor \sa TTF_SetTextColorFloat

extern SDL_DECLSPEC bool SDLCALL TTF_SetTextColor(TTF_Text *text, Uint8 r, Uint8 g, Uint8 b, Uint8 a)

Implementation

bool ttfSetTextColor(Pointer<TtfText> text, int r, int g, int b, int a) {
  final ttfSetTextColorLookupFunction = libSdl3Ttf.lookupFunction<
      Uint8 Function(Pointer<TtfText> text, Uint8 r, Uint8 g, Uint8 b, Uint8 a),
      int Function(Pointer<TtfText> text, int r, int g, int b,
          int a)>('TTF_SetTextColor');
  return ttfSetTextColorLookupFunction(text, r, g, b, a) == 1;
}