diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/sway/commands.c b/sway/commands.c index e7f1eafe..751dbe9c 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -567,34 +567,3 @@ char *cmd_results_to_json(list_t *res_list) { | |||
567 | json_object_put(result_array); | 567 | json_object_put(result_array); |
568 | return res; | 568 | return res; |
569 | } | 569 | } |
570 | |||
571 | /** | ||
572 | * Check and add color to buffer. | ||
573 | * | ||
574 | * return error object, or NULL if color is valid. | ||
575 | */ | ||
576 | struct cmd_results *add_color(char *buffer, const char *color) { | ||
577 | int len = strlen(color); | ||
578 | if (len != 7 && len != 9) { | ||
579 | return cmd_results_new(CMD_INVALID, | ||
580 | "Invalid color definition %s", color); | ||
581 | } | ||
582 | if (color[0] != '#') { | ||
583 | return cmd_results_new(CMD_INVALID, | ||
584 | "Invalid color definition %s", color); | ||
585 | } | ||
586 | for (int i = 1; i < len; ++i) { | ||
587 | if (!isxdigit(color[i])) { | ||
588 | return cmd_results_new(CMD_INVALID, | ||
589 | "Invalid color definition %s", color); | ||
590 | } | ||
591 | } | ||
592 | strcpy(buffer, color); | ||
593 | // add default alpha channel if color was defined without it | ||
594 | if (len == 7) { | ||
595 | buffer[7] = 'f'; | ||
596 | buffer[8] = 'f'; | ||
597 | } | ||
598 | buffer[9] = '\0'; | ||
599 | return NULL; | ||
600 | } | ||