nothing/src/color.h

35 lines
820 B
C
Raw Normal View History

2018-01-27 11:12:32 -08:00
#ifndef COLOR_H_
#define COLOR_H_
#include <stdio.h>
2019-05-25 06:29:35 -07:00
#include <SDL.h>
2019-12-15 11:13:31 -08:00
#include "./system/s.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)
#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
typedef struct Color {
2018-01-27 11:12:32 -08:00
float r, g, b, a;
} 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);
Color rgba_to_hsla(Color color);
2018-11-12 04:12:17 -08:00
Color hexstr(const char *hexstr);
2019-12-15 11:13:31 -08:00
Color hexs(String input);
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);
int color_hex_to_string(Color color, char *buffer, size_t buffer_size);
2019-06-16 13:01:42 -07:00
Color color_darker(Color color, float d);
Color color_desaturate(Color color);
2019-04-28 11:49:55 -07:00
Color color_invert(Color c);
Color color_scale(Color c, Color fc);
2018-01-27 11:12:32 -08:00
#endif // COLOR_H_