5 color_t color(float r, float g, float b, float a)
7 const color_t result = {
17 color_t color256(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
26 SDL_Color color_for_sdl(color_t color)
28 const SDL_Color result = {
29 .r = (Uint8)roundf(color.r * 255.0f),
30 .g = (Uint8)roundf(color.g * 255.0f),
31 .b = (Uint8)roundf(color.b * 255.0f),
32 .a = (Uint8)roundf(color.a * 255.0f)
38 color_t color_desaturate(color_t c)
40 const float k = (c.r + c.g + c.b) / 3.0f;
41 return color(k, k, k, c.a);