On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie <mut...@jgcomp.com> wrote:

> I've always preferred a black letters on white background scheme.
> However, after cataract surgery I'm considering using a dark
> background scheme.
> 
> Has anyone a technique for defining multiple color schemes and
> toggling among them while using mutt?
> 
> I already keep my color scheme in a separate file and source
> that file from ~/.muttrc.  To extend that, I created two
> files for light and dark schemes and separate macros (,l and ,d)
> to source them while running mutt.
> 
> I'd like to reduce that to a single macro that toggles between
> the files or one that allows selecting from multiple scheme
> files, perhaps in round robin fashion.
> 
> -- 
> Jon H. LaBadie                 mut...@jgcomp.com
>  11226 South Shore Rd.          (703) 787-0688 (H)
>  Reston, VA  20190              (703) 935-6720 (C)

Someone else will probably give a better answer, but
here goes. If you have different colour schemes setup
in different files, you can probably set up a macro in
your ~/.muttrc that enables the colour scheme you want
by sourcing the relevant file. e.g. something like:

  macro index something :source colour-scheme-1.muttrc\n
  macro index something :source colour-scheme-2.muttrc\n

Where "something" is a key sequence that doesn't
already do something you care about (e.g. A1, A2). You
might also need to define the macro in other places in
addition to "index".

Toggling will be more complicated, but doable, if it's really
needed. It might involve having the macro source a single file,
and also run an external command that replaces the contents of
that file with the "other" file. e.g. something like:

  macro index AA :!toggle-colour-scheme\n:source next-colour-scheme.muttrc\n

If you see what I mean (toggle-colour-scheme is a command
that swaps the files around).

Note: None of this is tested. It's just conjecture.

cheers,
raf

Reply via email to