2018-01-27 11:12:32 -08:00
|
|
|
#ifndef COLOR_H_
|
|
|
|
#define COLOR_H_
|
|
|
|
|
2019-06-17 10:51:59 -07:00
|
|
|
#include <stdio.h>
|
2019-05-25 06:29:35 -07:00
|
|
|
#include <SDL.h>
|
2018-01-27 11:12:32 -08:00
|
|
|
|
2019-06-22 10:40:38 -07:00
|
|
|
#define COLOR_BLACK rgba(0.0f, 0.0f, 0.0f, 1.0f)
|
2019-06-23 09:48:40 -07:00
|
|
|
#define COLOR_WHITE rgba(1.0f, 1.0f, 1.0f, 1.0f)
|
2019-06-30 10:21:52 -07:00
|
|
|
#define COLOR_RED rgba(1.0f, 0.0f, 0.0f, 1.0f)
|
2019-06-22 10:40:38 -07:00
|
|
|
|
2018-08-18 10:03:01 -07:00
|
|
|
typedef struct Color {
|
2018-01-27 11:12:32 -08:00
|
|
|
float r, g, b, a;
|
2018-08-18 10:03:01 -07:00
|
|
|
} Color;
|
2018-01-27 11:12:32 -08:00
|
|
|
|
2018-11-12 04:08:57 -08:00
|
|
|
Color rgba(float r, float g, float b, float a);
|
2019-06-30 10:23:54 -07:00
|
|
|
Color hsla(float h, float s, float l, float a);
|
2019-07-01 08:49:11 -07:00
|
|
|
Color rgba_to_hsla(Color color);
|
2018-11-12 04:12:17 -08:00
|
|
|
Color hexstr(const char *hexstr);
|
2018-08-18 10:03:01 -07:00
|
|
|
SDL_Color color_for_sdl(Color color);
|
2018-01-27 11:12:32 -08:00
|
|
|
|
2019-06-16 13:01:42 -07:00
|
|
|
int color_hex_to_stream(Color color, FILE *stream);
|
|
|
|
|
2018-08-18 10:03:01 -07:00
|
|
|
Color color_darker(Color color, float d);
|
2018-04-29 13:57:42 -07:00
|
|
|
|
2018-08-18 10:03:01 -07:00
|
|
|
Color color_desaturate(Color color);
|
2018-01-27 11:35:15 -08:00
|
|
|
|
2019-04-28 11:49:55 -07:00
|
|
|
Color color_invert(Color c);
|
|
|
|
|
2019-05-25 10:51:58 -07:00
|
|
|
Color color_scale(Color c, Color fc);
|
|
|
|
|
2018-01-27 11:12:32 -08:00
|
|
|
#endif // COLOR_H_
|