config: add tweak.bold-text-in-bright-amount

By how much to increase the luminance when brightening bold
fonts. This was previously hard-coded to a factor of 1.3, which is now
the default value of the new config option.

Closes #1434
This commit is contained in:
Daniel Eklöf 2023-07-26 16:12:36 +02:00
parent e912656682
commit f3c5b82c82
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 35 additions and 13 deletions

View file

@ -480,7 +480,7 @@ value_to_dimensions(struct context *ctx, uint32_t *x, uint32_t *y)
}
static bool NOINLINE
value_to_double(struct context *ctx, float *res)
value_to_float(struct context *ctx, float *res)
{
const char *s = ctx->value;
@ -659,7 +659,7 @@ value_to_pt_or_px(struct context *ctx, struct pt_or_px *res)
res->px = value;
} else {
float value;
if (!value_to_double(ctx, &value))
if (!value_to_float(ctx, &value))
return false;
res->pt = value;
res->px = 0;
@ -1089,7 +1089,7 @@ parse_section_scrollback(struct context *ctx)
}
else if (strcmp(key, "multiplier") == 0)
return value_to_double(ctx, &conf->scrollback.multiplier);
return value_to_float(ctx, &conf->scrollback.multiplier);
else {
LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
@ -1298,7 +1298,7 @@ parse_section_colors(struct context *ctx)
else if (strcmp(key, "alpha") == 0) {
float alpha;
if (!value_to_double(ctx, &alpha))
if (!value_to_float(ctx, &alpha))
return false;
if (alpha < 0. || alpha > 1.) {
@ -2461,7 +2461,7 @@ parse_section_tweak(struct context *ctx)
}
else if (strcmp(key, "box-drawing-base-thickness") == 0)
return value_to_double(ctx, &conf->tweak.box_drawing_base_thickness);
return value_to_float(ctx, &conf->tweak.box_drawing_base_thickness);
else if (strcmp(key, "box-drawing-solid-shades") == 0)
return value_to_bool(ctx, &conf->tweak.box_drawing_solid_shades);
@ -2472,6 +2472,9 @@ parse_section_tweak(struct context *ctx)
else if (strcmp(key, "sixel") == 0)
return value_to_bool(ctx, &conf->tweak.sixel);
else if (strcmp(key, "bold-text-in-bright-amount") == 0)
return value_to_float(ctx, &conf->bold_in_bright.amount);
else {
LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
return false;
@ -2939,6 +2942,7 @@ config_load(struct config *conf, const char *conf_path,
.bold_in_bright = {
.enabled = false,
.palette_based = false,
.amount = 1.3,
},
.startup_mode = STARTUP_WINDOWED,
.fonts = {{0}},