mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-13 05:33:51 -04: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
11e8ff9dc5
commit
1df48fcb33
5 changed files with 38 additions and 12 deletions
|
|
@ -42,8 +42,10 @@
|
||||||
(https://codeberg.org/dnkl/foot/issues/415).
|
(https://codeberg.org/dnkl/foot/issues/415).
|
||||||
* Foot now tries much harder to keep URL jump labels inside the window
|
* Foot now tries much harder to keep URL jump labels inside the window
|
||||||
geometry (https://codeberg.org/dnkl/foot/issues/443).
|
geometry (https://codeberg.org/dnkl/foot/issues/443).
|
||||||
* `bold-text-in-bright` now uses the corresponding bright palette
|
* `bold-text-in-bright` may now be set to `palette-based`, in which
|
||||||
color when the color to brighten matches one of the base 8 colors
|
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).
|
(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;
|
conf->resize_delay_ms = ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "bold-text-in-bright") == 0)
|
else if (strcmp(key, "bold-text-in-bright") == 0) {
|
||||||
conf->bold_in_bright = str_to_bool(value);
|
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) {
|
else if (strcmp(key, "bell") == 0) {
|
||||||
if (strcmp(value, "set-urgency") == 0)
|
if (strcmp(value, "set-urgency") == 0)
|
||||||
|
|
@ -2193,7 +2200,10 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
.pad_x = 2,
|
.pad_x = 2,
|
||||||
.pad_y = 2,
|
.pad_y = 2,
|
||||||
.resize_delay_ms = 100,
|
.resize_delay_ms = 100,
|
||||||
.bold_in_bright = false,
|
.bold_in_bright = {
|
||||||
|
.enabled = false,
|
||||||
|
.palette_based = false,
|
||||||
|
},
|
||||||
.bell_action = BELL_ACTION_NONE,
|
.bell_action = BELL_ACTION_NONE,
|
||||||
.startup_mode = STARTUP_WINDOWED,
|
.startup_mode = STARTUP_WINDOWED,
|
||||||
.fonts = {tll_init(), tll_init(), tll_init(), tll_init()},
|
.fonts = {tll_init(), tll_init(), tll_init(), tll_init()},
|
||||||
|
|
|
||||||
6
config.h
6
config.h
|
|
@ -79,7 +79,11 @@ struct config {
|
||||||
bool center;
|
bool center;
|
||||||
uint16_t resize_delay_ms;
|
uint16_t resize_delay_ms;
|
||||||
|
|
||||||
bool bold_in_bright;
|
struct {
|
||||||
|
bool enabled;
|
||||||
|
bool palette_based;
|
||||||
|
} bold_in_bright;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BELL_ACTION_NONE,
|
BELL_ACTION_NONE,
|
||||||
BELL_ACTION_URGENT,
|
BELL_ACTION_URGENT,
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,16 @@ in this order:
|
||||||
apply window management rules. Default: _foot_.
|
apply window management rules. Default: _foot_.
|
||||||
|
|
||||||
*bold-text-in-bright*
|
*bold-text-in-bright*
|
||||||
Boolean. When enabled, bold text is rendered in a brighter color
|
Semi-boolean. When enabled, bold text is rendered in a brighter
|
||||||
(in addition to using a bold font). Default: _no_.
|
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*
|
*bell*
|
||||||
Action to perform when receiving a *BEL* character. Can be set to
|
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
|
* First try to match the color against the base 8 colors. If we
|
||||||
* find a match, return the corresponding bright color.
|
* find a match, return the corresponding bright color.
|
||||||
*/
|
*/
|
||||||
for (size_t i = 0; i < 8; i++) {
|
if (term->conf->bold_in_bright.palette_based) {
|
||||||
if (term->colors.table[i] == color)
|
for (size_t i = 0; i < 8; i++) {
|
||||||
return term->colors.table[i + 8];
|
if (term->colors.table[i] == color)
|
||||||
|
return term->colors.table[i + 8];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int hue, sat, lum;
|
int hue, sat, lum;
|
||||||
|
|
@ -443,7 +445,7 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
|
|
||||||
if (cell->attrs.dim)
|
if (cell->attrs.dim)
|
||||||
_fg = color_dim(_fg);
|
_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);
|
_fg = color_brighten(term, _fg);
|
||||||
|
|
||||||
if (cell->attrs.blink && term->blink.state == BLINK_OFF)
|
if (cell->attrs.blink && term->blink.state == BLINK_OFF)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue