Re: multiple color schemes

2021-09-11 Thread Bastian
On 08Sep21 15:50-0400, Jon LaBadie wrote:
> On Wed, Sep 08, 2021 at 04:23:59PM +0300, Oleg A. Mamontov wrote:
> > On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie 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?

While talking about colors, I'd like to suggest to have a look at the 
solarized color schemes. Configs for those are available for many 
programs (from terminal emulators up to e.g. heavy weight GUIs of IDEs).

Primarily, I use rxvt with a simple extension (perl) which switches 
the color scheme of the console between solarized-{light,dark}. Thus, 
not only mutt, but the entire console is using the same theme; in 
particular also vim, while composing the mail.

-- 
Bastian


Re: multiple color schemes

2021-09-09 Thread Ed Blackman
On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie wrote:
> 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.

I use this to toggle printer destinations between three settings:

In ~/.mutt/muttrc:
 source ~/.mutt/rc/print-normal.rc

In ~/.mutt/rc/print-normal.rc:
 macro index  ":source ~/.mutt/rc/print-pdf.rc\n"
 set print_command="~/.mutt/bin/muttPrint --highlight=mail"
 set ?print_command

In ~/.mutt/rc/print-pdf.rc:
 macro index  ":source ~/.mutt/rc/print-pdf-onepage.rc\n"
 set print_command="~/.mutt/bin/muttPrint --highlight=mail -P PDF"
 set ?print_command

In ~/.mutt/rc/print-pdf-onepage.rc:
 macro index  ":source ~/.mutt/rc/print-normal.rc\n"
 set print_command="~/.mutt/bin/muttPrint --highlight=mail -P PDF -a 1"
 set ?print_command

So each redefines ^P to source the *next* one in the round-robin.  When 
sourced, it changes, then echos, the print_command, to remind me where I am in 
the rotation.  Probably not needed for something immediately visible like the 
color scheme.

-- 
Ed Blackman


Re: multiple color schemes

2021-09-09 Thread Anders Damsgaard

* Jon LaBadie  [2021-09-08 01:20:27 -0400]:


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)


Hi Jon,

What about keeping mutt to default foreground and background colors, and
switching the terminal color scheme instead?  I have this set up, and it
allows me to change the color scheme across any terminal programs I use.
While white fg on black bg is my usual preference, black fg on white bg
is more readable to me when I'm outside and there is more ambient glare
on the display.

I use the following mutt colors definitions:

color normal default  default
color indicator  default  color7
color status default  default
color index  bold  default  default  ~N|~F|~T|~D
mono  index  bold  ~N|~F|~T|~D

My terminal is a patched version of st (https://st.suckless.org), where
I added Ctrl-Shift-x to flip between two color schemes:

https://src.adamsgaard.dk/st/files.html
git://src.adamsgaard.dk/st

Color schemes (colorname and altcolorname arrays) and other options are
set in config.h at compile time.

Just my two cents!

Cheers, Anders


Re: multiple color schemes

2021-09-08 Thread raf
On Wed, Sep 08, 2021 at 03:47:00PM -0400, Jon LaBadie  wrote:

> On Wed, Sep 08, 2021 at 04:31:11PM +1000, raf wrote:
> > On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie  
> > 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.
> > 
> > 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).
> 
> That is exactly what I've currently implemented.
> 
> For macro names, I sometimes pick my favorite single letter
> and add a leading comma.  So my two macros are named ,d (dark)
> and ,l (light).
> 
> > 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:
> 
> schemes that edit or copy files seem too prone to unanticipated
> mess-ups.
> 
> Jon
> -- 
> Jon H. LaBadie j...@labadie.us
>  11226 South Shore Rd.  (703) 787-0688 (H)
>  Reston, VA  20190  (703) 935-6720 (C)

Yes. Oleg's approach is much better.

cheers,
raf



Re: multiple color schemes

2021-09-08 Thread Oleg A. Mamontov

On Wed, Sep 08, 2021 at 03:50:23PM -0400, Jon LaBadie wrote:

On Wed, Sep 08, 2021 at 04:23:59PM +0300, Oleg A. Mamontov wrote:

On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie 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.


You can try something like below approach with dynamically redefined
macro:

~/.muttrc
---
macro index XX source ~/.mutt/colors1.muttrc
---

~/.mutt/colors1.muttrc
---
# colors #1
macro index XX source ~/.mutt/colors2.muttrc
---

~/.mutt/colors2.muttrc
---
# colors #2
macro index XX source ~/.mutt/colors1.muttrc
---


Interesting approach.

Some interpreted languages prevent the redefinition
of a macro while that macro is executing.  Not sure
about mutt's interpreter, I'll have to check.


While I believe mutt isn't the case, you can use similar approach but
with variables only:

~/.muttrc
---
set my_colors = '2';
macro index AA ':source ~/.mutt/colors.$my_colors.muttrc'
---

~/.mutt/colors.1.muttrc
---
# colors #1
set my_colors = '2';
---

~/.mutt/colors.2.muttrc
---
# colors #2
set my_colors = '1';
---

Just tested it successfuly. Hope this helps.


thanks,

--
Jon H. LaBadie mut...@jgcomp.com
11226 South Shore Rd.  (703) 787-0688 (H)
Reston, VA  20190  (703) 935-6720 (C)


--
Cheers,
Oleg A. Mamontov

mailto: o...@mamontov.net

skype:  lonerr11
cell:   +7 (903) 798-1352


Re: multiple color schemes

2021-09-08 Thread Jon LaBadie

On Wed, Sep 08, 2021 at 04:23:59PM +0300, Oleg A. Mamontov wrote:

On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie 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.


You can try something like below approach with dynamically redefined
macro:

~/.muttrc
---
macro index XX source ~/.mutt/colors1.muttrc
---

~/.mutt/colors1.muttrc
---
# colors #1
macro index XX source ~/.mutt/colors2.muttrc
---

~/.mutt/colors2.muttrc
---
# colors #2
macro index XX source ~/.mutt/colors1.muttrc
---


Interesting approach.

Some interpreted languages prevent the redefinition
of a macro while that macro is executing.  Not sure
about mutt's interpreter, I'll have to check.

thanks,

--
Jon H. LaBadie mut...@jgcomp.com
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)


Re: multiple color schemes

2021-09-08 Thread Jon LaBadie

On Wed, Sep 08, 2021 at 04:31:11PM +1000, raf wrote:

On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie  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.


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). 


That is exactly what I've currently implemented.

For macro names, I sometimes pick my favorite single letter
and add a leading comma.  So my two macros are named ,d (dark)
and ,l (light).


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:


schemes that edit or copy files seem too prone to unanticipated
mess-ups.

Jon
--
Jon H. LaBadie j...@labadie.us
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)


Re: multiple color schemes

2021-09-08 Thread Oleg A. Mamontov

On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie 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.


You can try something like below approach with dynamically redefined
macro:

~/.muttrc
---
macro index XX source ~/.mutt/colors1.muttrc
---

~/.mutt/colors1.muttrc
---
# colors #1
macro index XX source ~/.mutt/colors2.muttrc
---

~/.mutt/colors2.muttrc
---
# colors #2
macro index XX source ~/.mutt/colors1.muttrc
---



--
Jon H. LaBadie mut...@jgcomp.com
11226 South Shore Rd.  (703) 787-0688 (H)
Reston, VA  20190  (703) 935-6720 (C)


--
Cheers,
Oleg A. Mamontov

mailto: o...@mamontov.net

skype:  lonerr11
cell:   +7 (903) 798-1352


Re: multiple color schemes

2021-09-08 Thread raf
On Wed, Sep 08, 2021 at 01:20:27AM -0400, Jon LaBadie  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