mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
config: bold-text-in-bright: add ‘palette-based’ as a special value
When ‘bold-text-in-bright’ is set ‘to palette-based’, colors matching one of the 8 regular palette colors are brightened by using the corresponding bright palette color. Other colors, or all colors if ‘bold-text-in-bright’ is set to ‘yes|true’, are brightened by increasing the luminance.
This commit is contained in:
parent
2cd9fee9c4
commit
cdfc864cf0
5 changed files with 38 additions and 12 deletions
|
|
@ -42,8 +42,10 @@
|
|||
(https://codeberg.org/dnkl/foot/issues/415).
|
||||
* Foot now tries much harder to keep URL jump labels inside the window
|
||||
geometry (https://codeberg.org/dnkl/foot/issues/443).
|
||||
* `bold-text-in-bright` now uses the corresponding bright palette
|
||||
color when the color to brighten matches one of the base 8 colors
|
||||
* `bold-text-in-bright` may now be set to `palette-based`, in which
|
||||
case it will use the corresponding bright palette color when the
|
||||
color to brighten matches one of the base 8 colors, instead of
|
||||
increasing the luminance
|
||||
(https://codeberg.org/dnkl/foot/issues/449).
|
||||
|
||||
|
||||
|
|
|
|||
16
config.c
16
config.c
|
|
@ -583,8 +583,15 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
|||
conf->resize_delay_ms = ms;
|
||||
}
|
||||
|
||||
else if (strcmp(key, "bold-text-in-bright") == 0)
|
||||
conf->bold_in_bright = str_to_bool(value);
|
||||
else if (strcmp(key, "bold-text-in-bright") == 0) {
|
||||
if (strcmp(value, "palette-based") == 0) {
|
||||
conf->bold_in_bright.enabled = true;
|
||||
conf->bold_in_bright.palette_based = true;
|
||||
} else {
|
||||
conf->bold_in_bright.enabled = str_to_bool(value);
|
||||
conf->bold_in_bright.palette_based = false;
|
||||
}
|
||||
}
|
||||
|
||||
else if (strcmp(key, "bell") == 0) {
|
||||
if (strcmp(value, "set-urgency") == 0)
|
||||
|
|
@ -2193,7 +2200,10 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.pad_x = 2,
|
||||
.pad_y = 2,
|
||||
.resize_delay_ms = 100,
|
||||
.bold_in_bright = false,
|
||||
.bold_in_bright = {
|
||||
.enabled = false,
|
||||
.palette_based = false,
|
||||
},
|
||||
.bell_action = BELL_ACTION_NONE,
|
||||
.startup_mode = STARTUP_WINDOWED,
|
||||
.fonts = {tll_init(), tll_init(), tll_init(), tll_init()},
|
||||
|
|
|
|||
6
config.h
6
config.h
|
|
@ -79,7 +79,11 @@ struct config {
|
|||
bool center;
|
||||
uint16_t resize_delay_ms;
|
||||
|
||||
bool bold_in_bright;
|
||||
struct {
|
||||
bool enabled;
|
||||
bool palette_based;
|
||||
} bold_in_bright;
|
||||
|
||||
enum {
|
||||
BELL_ACTION_NONE,
|
||||
BELL_ACTION_URGENT,
|
||||
|
|
|
|||
|
|
@ -200,8 +200,16 @@ in this order:
|
|||
apply window management rules. Default: _foot_.
|
||||
|
||||
*bold-text-in-bright*
|
||||
Boolean. When enabled, bold text is rendered in a brighter color
|
||||
(in addition to using a bold font). Default: _no_.
|
||||
Semi-boolean. When enabled, bold text is rendered in a brighter
|
||||
color (in addition to using a bold font). The color is brightened
|
||||
by increasing its luminance.
|
||||
|
||||
If set to *palette-based*, rather than a simple *yes|true*, colors
|
||||
matching one of the 8 regular palette colors will be brightened
|
||||
using the corresponding bright palette color. Other colors will be
|
||||
brightened by increasing the luminance.
|
||||
|
||||
Default: _no_.
|
||||
|
||||
*bell*
|
||||
Action to perform when receiving a *BEL* character. Can be set to
|
||||
|
|
|
|||
10
render.c
10
render.c
|
|
@ -258,9 +258,11 @@ color_brighten(const struct terminal *term, uint32_t color)
|
|||
* First try to match the color against the base 8 colors. If we
|
||||
* find a match, return the corresponding bright color.
|
||||
*/
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
if (term->colors.table[i] == color)
|
||||
return term->colors.table[i + 8];
|
||||
if (term->conf->bold_in_bright.palette_based) {
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
if (term->colors.table[i] == color)
|
||||
return term->colors.table[i + 8];
|
||||
}
|
||||
}
|
||||
|
||||
int hue, sat, lum;
|
||||
|
|
@ -443,7 +445,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
|
||||
if (cell->attrs.dim)
|
||||
_fg = color_dim(_fg);
|
||||
if (term->conf->bold_in_bright && cell->attrs.bold)
|
||||
if (term->conf->bold_in_bright.enabled && cell->attrs.bold)
|
||||
_fg = color_brighten(term, _fg);
|
||||
|
||||
if (cell->attrs.blink && term->blink.state == BLINK_OFF)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue