bar_cmd_colors: remove add_color

This is the third commit in a series of commits to refactor color
handling in sway. This removes add_color from commands.c. It was only
being used by bar_cmd_colors. This also changes the functions to use
parse_color which is used to validate rgb(a) colors throughout the code
base and is also what i3bar is using to parse the colors after they are
passed over ipc. After parsing the color and ensuring it is valid, the
rgba hex string is then generated using snprintf. This refactor also
ensures that all the colors for the command are valid before applying
any of them.
This commit is contained in:
Brian Ashworth 2019-12-28 04:01:38 -05:00 committed by Simon Ser
parent 66dc33296c
commit f898ca9a83
3 changed files with 33 additions and 49 deletions

View file

@ -88,8 +88,6 @@ void free_cmd_results(struct cmd_results *results);
*/
char *cmd_results_to_json(list_t *res_list);
struct cmd_results *add_color(char *buffer, const char *color);
/**
* TODO: Move this function and its dependent functions to container.c.
*/