WIP: settings, color picker and stuff

This commit is contained in:
2024-01-05 22:19:31 +02:00
parent b8d11050f8
commit bba2f8a189
10 changed files with 561 additions and 68 deletions
+23
View File
@@ -84,3 +84,26 @@ Color mult_color(Color color, float amount) {
return result;
}
Color hsv2rgb(float h, float s, float v) {
float c = v * s;
float x = (float)(c * (1 - fabs(fmod(h / 60.0, 2) - 1)));
float m = v - c;
float r, g, b;
if (h >= 0 && h < 60) {
r = c, g = x, b = 0;
} else if (h >= 60 && h < 120) {
r = x, g = c, b = 0;
} else if (h >= 120 && h < 180) {
r = 0, g = c, b = x;
} else if (h >= 180 && h < 240) {
r = 0, g = x, b = c;
} else if (h >= 240 && h < 300) {
r = x, g = 0, b = c;
} else {
r = c, g = 0, b = x;
}
return (Color){(u8)((r + m) * 255), (u8)((g + m) * 255), (u8)((b + m) * 255), 255};
}