On Sun, 8 Oct 2017 16:38:47 +0200 Petr Vorel <petr.vo...@gmail.com> wrote:
> diff --git a/include/json_print.h b/include/json_print.h > index b6ce1f9f..2f3f07c8 100644 > --- a/include/json_print.h > +++ b/include/json_print.h > @@ -53,7 +53,7 @@ void close_json_array(enum output_type type, const char > *delim); > const char *fmt, \ > type value) \ > { \ > - print_color_##type_name(t, -1, key, fmt, value); \ > + print_color_##type_name(t, 0, key, fmt, value); \ > } > _PRINT_FUNC(int, int); > _PRINT_FUNC(bool, bool); > diff --git a/lib/color.c b/lib/color.c > index 79d5e289..e597798f 100644 > --- a/lib/color.c > +++ b/lib/color.c > @@ -110,7 +110,7 @@ int color_fprintf(FILE *fp, enum color_attr attr, const > char *fmt, ...) > } > > ret += fprintf(fp, "%s", > - color_codes[attr_colors[is_dark_bg ? attr + 8 : attr]]); > + color_codes[attr_colors[is_dark_bg ? attr + 6 : attr - > 1]]); Magic offsets (8 and -1) are error prone. Can this be changed to an enum value from colors?