diff options
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | config.c | 4 | ||||
| -rw-r--r-- | config.h | 1 | ||||
| -rw-r--r-- | doc/foot.ini.5.scd | 4 | ||||
| -rw-r--r-- | foot.ini | 1 | ||||
| -rw-r--r-- | render.c | 10 |
6 files changed, 23 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cadd8fa..e45b2e58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,9 @@ not possible to add a command to these actions when used in mouse bindings, making them useless (https://codeberg.org/dnkl/foot/issues/183). +* **bold-text-in-bright** option to `foot.ini`. When enabled, bold + text is rendered in a brighter color + (https://codeberg.org/dnkl/foot/issues/199). ### Changed @@ -519,6 +519,9 @@ parse_section_main(const char *key, const char *value, struct config *conf, conf->pad_y = y; } + else if (strcmp(key, "bold-text-in-bright") == 0) + conf->bold_in_bright = str_to_bool(value); + else if (strcmp(key, "bell") == 0) { if (strcmp(value, "set-urgency") == 0) conf->bell_is_urgent = true; @@ -2017,6 +2020,7 @@ config_load(struct config *conf, const char *conf_path, }, .pad_x = 2, .pad_y = 2, + .bold_in_bright = false, .bell_is_urgent = false, .startup_mode = STARTUP_WINDOWED, .fonts = {tll_init(), tll_init(), tll_init(), tll_init()}, @@ -79,6 +79,7 @@ struct config { unsigned pad_x; unsigned pad_y; + bool bold_in_bright; bool bell_is_urgent; enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode; diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index fea26fcf..cfa5b667 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -101,6 +101,10 @@ in this order: (including SMT). Note that this is not always the best value. In some cases, the number of physical _cores_ is better. +*bold-text-in-bright* + Boolean. When enabled, bold text is rendered in a brighter color + (in addition to using a bold font). Default: _no_. + *bell* Action to perform when receiving a *BEL* character. Can be set to either *set-urgency* or *none*. @@ -12,6 +12,7 @@ # term=foot # login-shell=no # workers=<number of logical CPUs> +# bold-text-in-bright=no # bell=none # word-delimiters=,│`|:"'()[]{}<> @@ -240,6 +240,14 @@ color_dim(pixman_color_t *color) } static inline void +color_brighten(pixman_color_t *color) +{ + color->red = color->red * 2 <= 0xffff ? color->red * 2 : 0xffff; + color->green = color->green * 2 <= 0xffff ? color->green * 2 : 0xffff; + color->blue = color->blue * 2 <= 0xffff ? color->blue * 2 : 0xffff; +} + +static inline void color_dim_for_search(pixman_color_t *color) { color->red /= 2; @@ -407,6 +415,8 @@ render_cell(struct terminal *term, pixman_image_t *pix, if (cell->attrs.dim) color_dim(&fg); + if (term->conf->bold_in_bright && cell->attrs.bold) + color_brighten(&fg); if (cell->attrs.blink && term->blink.state == BLINK_OFF) color_dim(&fg); |
