summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/gfxx.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/bin/gfxx.c b/bin/gfxx.c
index 45fe39df..8a43fd2f 100644
--- a/bin/gfxx.c
+++ b/bin/gfxx.c
@@ -117,17 +117,15 @@ int init(int argc, char *argv[]) {
         fclose(file);
     } else {
         for (int i = 0; i < 256; ++i) {
-            double h = i * 360.0 / 256.0 / 60.0, s = 1.0, v = 1.0;
-            double c = v * s;
-            double x = c * (1.0 - fabs(fmod(h, 2.0) - 1.0));
-            double r = v - c, g = v - c, b = v - c;
-            if (h <= 1.0)      { r += c; g += x; }
-            else if (h <= 2.0) { r += x; g += c; }
-            else if (h <= 3.0) { g += c; b += x; }
-            else if (h <= 4.0) { g += x; b += c; }
-            else if (h <= 5.0) { r += x; b += c; }
-            else if (h <= 6.0) { r += c; b += x; }
-            r *= 255.0; g *= 255.0; b *= 255.0;
+            double h = i / 256.0 * 6.0;
+            double x = 1.0 - fabs(fmod(h, 2.0) - 1.0);
+            double r = 255.0, g = 255.0, b = 255.0;
+            if      (h <= 1.0) { g *= x; b = 0.0; }
+            else if (h <= 2.0) { r *= x; b = 0.0; }
+            else if (h <= 3.0) { r = 0.0; b *= x; }
+            else if (h <= 4.0) { r = 0.0; g *= x; }
+            else if (h <= 5.0) { r *= x; g = 0.0; }
+            else if (h <= 6.0) { g = 0.0; b *= x; }
             palette[i] = (uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b;
         }
     }
d=e75ccfe6f6fe411f50465a206c2b56e2d2c1233d&follow=1'>Update cgit-causal-agencyJune McEnroe 2021-01-17Update scooper to 1.1June McEnroe 2021-01-17Update catgirl to 1.5 (BONUS WEBISODE)June McEnroe 2021-01-15Update litterbox to 1.7June McEnroe 2021-01-15Update pounce to 2.2June McEnroe 2021-01-15Update catgirl to 1.4June McEnroe 2020-12-28Replace cgit-patched with cgit-causal-agencyJune McEnroe 2020-12-18Add notemap portJune McEnroe 2020-12-15Update libretls to 3.3.1June McEnroe 2020-12-15Update catsit to 1.1June McEnroe 2020-12-15Update pounce to 2.1p1June McEnroe 2020-12-15Add imbox portJune McEnroe 2020-11-24Update pounce to 2.1June McEnroe 2020-11-24Update libretls to 3.3.0June McEnroe 2020-11-17Update catgirl to 1.3June McEnroe 2020-11-17Update libretls to 3.2.2June McEnroe 2020-09-29Update libretls to 3.2.1June McEnroe 2020-09-10Update catgirl to 1.2June McEnroe 2020-09-09Add pounce-palaver portJune McEnroe 2020-09-09Update pounce to 2.0June McEnroe 2020-09-09Update litterbox to 1.6June McEnroe 2020-08-23Add scooper portJune McEnroe 2020-08-23Add catsit portJune McEnroe 2020-08-13Update pounce to 1.4p2June McEnroe 2020-08-11Update pounce to 1.4p1June McEnroe 2020-08-10Add litterbox portJune McEnroe 2020-08-10Add missing USES=pkgconfig to pounceJune McEnroe