A simple colours manipulation library in c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

43 lines
751 B

#ifndef COSMOPOLITAN
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
#endif
#ifndef H_COLOURS
#define H_COLOURS
enum colour_space {
CS_INVALID = 0,
CS_RGB = 1, // default to RGB
CS_HSV = 2,
CS_HSL = 3,
};
struct colour {
double h;
double s;
double v;
double l;
int r;
int g;
int b;
enum colour_space sp;
};
struct colour get_random_color(unsigned int seed);
// doesn't support hsl-hsv or converse, conversion
struct colour get_hsl(struct colour c);
struct colour get_hsv(struct colour c);
struct colour get_rgb(struct colour c);
struct colour *get_adjacent(struct colour base, int deg, int num);
void print_colour(struct colour c);
#endif