summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bin/scheme.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/bin/scheme.c b/bin/scheme.c
index d008ea51..df69b903 100644
--- a/bin/scheme.c
+++ b/bin/scheme.c
@@ -112,11 +112,9 @@ static void png(const struct Hsv *scheme, uint8_t len) {
     pngInt(crc);
 }
 
-static void linux(const struct Hsv *scheme, uint8_t len) {
-    if (len > 16) len = 16;
+static void hsv(const struct Hsv *scheme, uint8_t len) {
     for (uint8_t i = 0; i < len; ++i) {
-        struct Rgb rgb = toRgb(scheme[i]);
-        printf("\x1B]P%x%02x%02x%02x", i, rgb.r, rgb.g, rgb.b);
+        printf("%g,%g,%g\n", scheme[i].h, scheme[i].s, scheme[i].v);
     }
 }
 
@@ -127,6 +125,14 @@ static void hex(const struct Hsv *scheme, uint8_t len) {
     }
 }
 
+static void linux(const struct Hsv *scheme, uint8_t len) {
+    if (len > 16) len = 16;
+    for (uint8_t i = 0; i < len; ++i) {
+        struct Rgb rgb = toRgb(scheme[i]);
+        printf("\x1B]P%x%02x%02x%02x", i, rgb.r, rgb.g, rgb.b);
+    }
+}
+
 static const struct Hsv R = {   0.0, 1.0, 1.0 };
 static const struct Hsv Y = {  60.0, 1.0, 1.0 };
 static const struct Hsv G = { 120.0, 1.0, 1.0 };
@@ -184,13 +190,14 @@ static struct Terminal genTerminal(struct Ansi ansi) {
 
 int main(int argc, char *argv[]) {
     enum { ANSI, TERMINAL } generate = ANSI;
-    enum { HEX, LINUX, PNG } output = HEX;
+    enum { HSV, HEX, LINUX, PNG } output = HEX;
 
     int opt;
-    while (0 < (opt = getopt(argc, argv, "agltx"))) {
+    while (0 < (opt = getopt(argc, argv, "aghltx"))) {
         switch (opt) {
             case 'a': generate = ANSI; break;
             case 'g': output = PNG; break;
+            case 'h': output = HSV; break;
             case 'l': output = LINUX; break;
             case 't': generate = TERMINAL; break;
             case 'x': output = HEX; break;
@@ -215,6 +222,7 @@ int main(int argc, char *argv[]) {
     }
 
     switch (output) {
+        case HSV: hsv(scheme, len); break;
         case HEX: hex(scheme, len); break;
         case LINUX: linux(scheme, len); break;
         case PNG: png(scheme, len); break;
d colspan='3' class='logmsg'> 2024-06-30Add photos from June 22 (and the few days after that)June McEnroe 2024-06-30Accommodate lower-case .jpg filesJune McEnroe 2024-06-23Add another BACKXWASH showJune McEnroe It was good! 2024-06-16Update bioJune McEnroe 2024-06-15Add photo descriptions from June 12June McEnroe 2024-06-10Add first roll of film from June 8June McEnroe 2024-06-10Cope with not having an EXIF infoJune McEnroe 2024-06-10Resize using target pixel counts for consistencyJune McEnroe This will resize film scans to about the same size as for the digital photos. 2024-06-10Add The Girl Who Was Convinced...June McEnroe Not much there. The illustrations are very nice though. 2024-06-09Add photos from May 31June McEnroe 2024-06-09Use monospace on photo pagesJune McEnroe 2024-06-09Put lens and (future) film at the tops of photo pagesJune McEnroe 2024-05-22Remove use of sysexits.hJune McEnroe 2024-05-22Add photo descriptions from 05-03 and 05-06June McEnroe 2024-05-21Fix = precedence in whenJune McEnroe