Commit 40d6ef029cfd2bfb3251139ae8efdb745d6ee4bc Parent: 426823cb6a389d22cf13d8320007b70f41d661d9 Author: mcol <mcol@posteo.net> Date: 2021-03-01 00:54:07 +0000 Committer: mcol <mcol@posteo.net> Committed: 2021-03-01 00:54:07 +0000 allow 8-digit colours
wimp.conf Modified
@@ -39,6 +39,9 @@ #wimptool set zoom_min 0.2 #wimptool set zoom_max 5 +# Set the colour for the snap box indicator shown when dragging +#wimptool set snap_box \#47315c66 + # Set the colour for the mark setter/getter indicator #wimptool set mark_indicator #000000
src/ipc.c Modified
@@ -69,7 +69,7 @@ "set desk 2 borders normal #31475c", "set desk 2 corners normal #3e5973", "set mark_indicator #47315c", - "set snap_box #47315c", + "set snap_box 47315c66", "set mod Logo", "set vt_switching on", "bind Ctrl Escape terminate",
src/config.c Modified
@@ -20,18 +20,29 @@ void assign_colour(char *hex, float dest[4]) { - if (strlen(hex) != 7 || hex[0] != '#') { - wlr_log(WLR_INFO, "Invalid colour: %s. Should be in the form #rrggbb.", hex); + if (!hex) { return; } - hex++; + if (hex[0] == '#') { + hex++; + } char c[2]; - for (int i = 0; i < 3; i++) { + int copy; + if (strlen(hex) == 6) { + dest[3] = 1; + copy = 3; + } else if (strlen(hex) == 8) { + copy = 4; + } else { + wlr_log(WLR_INFO, "Invalid colour: %s. Should be in the form #rrggbb.", hex); + return; + } + + for (int i = 0; i < copy; i++) { strncpy(c, &hex[i * 2], 2); dest[i] = (float)strtol(c, NULL, 16) / 255; } - dest[3] = 1; }