CHANGE_COLOR: Save the palette with #saveoptions

This commit is contained in:
Pasi Kallinen
2024-04-18 09:23:37 +03:00
parent 7db8f7c6a5
commit bb3b9b7271

View File

@@ -355,6 +355,9 @@ staticfn void all_options_conds(strbuf_t *);
staticfn void all_options_menucolors(strbuf_t *);
staticfn void all_options_msgtypes(strbuf_t *);
staticfn void all_options_apes(strbuf_t *);
#ifdef CHANGE_COLOR
staticfn void all_options_palette(strbuf_t *);
#endif
staticfn void remove_autopickup_exception(struct autopickup_exception *);
staticfn int count_apes(void);
staticfn int count_cond(void);
@@ -9417,6 +9420,26 @@ all_options_apes(strbuf_t *sbuf)
}
}
#ifdef CHANGE_COLOR
staticfn void
all_options_palette(strbuf_t *sbuf)
{
int clr, n = count_alt_palette();
char buf[BUFSZ];
if (!n)
return;
for (clr = 0; clr < CLR_MAX; ++clr) {
if (ga.altpalette[clr] != 0U) {
Sprintf(buf, "OPTIONS=palette:%s/#%06x\n",
clr2colorname(clr), COLORVAL(ga.altpalette[clr]));
strbuf_append(sbuf, buf);
}
}
}
#endif /* CHANGE_COLOR */
/* return strbuf of all options, to write to file */
void
all_options_strbuf(strbuf_t *sbuf)
@@ -9472,6 +9495,9 @@ all_options_strbuf(strbuf_t *sbuf)
if (opt_set_in_config[pfx_cond_])
all_options_conds(sbuf);
#ifdef CHANGE_COLOR
all_options_palette(sbuf);
#endif
get_changed_key_binds(sbuf);
savedsym_strbuf(sbuf);
all_options_menucolors(sbuf);