Subject: bug#57639: [PATCH] Add new command 'toggle-theme'

From: Philip Kaludercic <[email-masked]>
Date: Sun, 11 Sep 2022 08:26:53 +0000

Lars Ingebrigtsen <[email-masked]> writes:

> Philip Kaludercic <[email-masked]> writes:
>
>> Do you think it would be better to less general, and instead of talking
>> about "dual" themes always assume we want to toggle between a light and
>> a dark variant?  If not, this sounds like a separate feature (say that
>> could be handled by a different property `theme-variant').
>
> Well, if we had marking for "theme with variant", then we'd know which
> themes are "the same", but with a variant.
>
> So your command could instead be `theme-choose-variant', but since
> there's only two variants here, it'd toggle.  If there were more, the
> user would be prompted for which variant to use, which would cover
> gruvbox, which Stefan mentioned.

So we are thinking about something like a symbol property
`theme-variants' that each theme symbol may have attached.  This symbol
could point to a list representing a set of alternatives.  Let's say the
set might contain the theme itself (for the sake of convenience), so it
is remq'ed before we check if the set has more than one alternative.  If
it does we use a modified `load-theme'-like prompt, otherwise we toggle.
I think it would also make sense to silently remove non-existent themes
automatically, in case a variant theme is not part of the same package.

I think it would make sense to alias the name, since most themes, if
they do have variants just come with dark and light where "toggle" is
a more intuitive term.

> And in addition, this tagging could be used for automatic dark/light OS
> changes, so it's at least three birds with one stone.

OK, but that is a long-term plan, or do the means already exist for
detecting these kinds of changes?

Also, how to be distinguish between what is light and dark, and what do
we do when a theme has multiple variants?