]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #2838 from acrisci/bug/colors-only-hex
authorIngo Bürk <admin@airblader.de>
Thu, 13 Jul 2017 04:50:05 +0000 (06:50 +0200)
committerGitHub <noreply@github.com>
Thu, 13 Jul 2017 04:50:05 +0000 (06:50 +0200)
Ensure colors are in hex

i3bar/src/child.c
libi3/draw_util.c

index 60ab462a5a73fba00e62b11e93f79439c86f265b..814f041110d48db57c296a6cc0a47d59ce98954d 100644 (file)
@@ -112,13 +112,13 @@ __attribute__((format(printf, 1, 2))) static void set_statusline_error(const cha
     struct status_block *err_block = scalloc(1, sizeof(struct status_block));
     err_block->full_text = i3string_from_utf8("Error: ");
     err_block->name = sstrdup("error");
-    err_block->color = sstrdup("red");
+    err_block->color = sstrdup("#ff0000");
     err_block->no_separator = true;
 
     struct status_block *message_block = scalloc(1, sizeof(struct status_block));
     message_block->full_text = i3string_from_utf8(message);
     message_block->name = sstrdup("error_message");
-    message_block->color = sstrdup("red");
+    message_block->color = sstrdup("#ff0000");
     message_block->no_separator = true;
 
     TAILQ_INSERT_HEAD(&statusline_head, err_block, blocks);
index e4f0d065abcb9b010cbb49fe60af73ca4b48ae96..6a2e93dcd8e3a413099e2e34b119fcfbf13faf93 100644 (file)
@@ -84,6 +84,11 @@ void draw_util_surface_set_size(surface_t *surface, int width, int height) {
  *
  */
 color_t draw_util_hex_to_color(const char *color) {
+    if (strlen(color) < 6 || color[0] != '#') {
+        ELOG("Could not parse color: %s\n", color);
+        return draw_util_hex_to_color("#A9A9A9");
+    }
+
     char alpha[2];
     if (strlen(color) == strlen("#rrggbbaa")) {
         alpha[0] = color[7];