config: add initial-color-theme=1|2

This option selects which color theme to use by default. I.e. at
startup, and after a reset.

This is useful with combined theme files, where a single file defines
e.g. both a dark and light version of the theme.
This commit is contained in:
Daniel Eklöf 2025-04-21 12:19:11 +02:00
parent 10e7f29149
commit bc5b716668
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 58 additions and 15 deletions

View file

@ -1098,6 +1098,15 @@ parse_section_main(struct context *ctx)
return true;
}
else if (streq(key, "initial-color-theme")) {
_Static_assert(
sizeof(conf->initial_color_theme) == sizeof(int),
"enum is not 32-bit");
return value_to_enum(ctx, (const char*[]){"1", "2", NULL},
(int *)&conf->initial_color_theme);
}
else {
LOG_CONTEXTUAL_ERR("not a valid option: %s", key);
return false;
@ -3402,7 +3411,7 @@ config_load(struct config *conf, const char *conf_path,
.url = false,
},
},
.initial_color_theme = COLOR_THEME1,
.cursor = {
.style = CURSOR_BLOCK,
.unfocused_style = CURSOR_UNFOCUSED_HOLLOW,