On Wed, Apr 16, 2025 at 03:05:15PM -0500, Ranjan Maitra via Mutt-users wrote:
> Hi,
> 
> So, I like to have my email window to have a light theme and
> everything else to have a dark theme (to distinguish things easily
> and sort of intuitively). 
... 
> I tried using `xterm -bg "#ffffff" -fg '#000000' -e mutt`` and that
> does help some, however, I am not sure if there is a better
> preferred way. 

Oh yeah.

One of the things that seems to have been completely lost on modern
desktop environment developers is that the old X programs, xterm
included, were customizable IN THE EXTREME, and very easily so.

Like most of the programs that came with the original X Window System,
xterm relies on "X resources" for configuration.  On most modern Linux
systems, you can create a file in your home directory called
.Xresources, and then define the resources you want for the seemingly
infinite configurable properties that xterm has.  You might need to
call it .Xdefaults on your system; I usually just make a symlink from
one to the other just to be safe.  For example, I have the following
in my .Xresources file:

/* color scheme */
XTerm.vt100.foreground: #E0E0C0
XTerm.vt100.background: #303030
XTerm.vt100.titeInhibit:  true
! terminal colors 0-15 
XTerm.vt100.color0: #000000
XTerm.vt100.color1: #FF0000
XTerm.vt100.color2: #00C000
XTerm.vt100.color3: Yellow
XTerm.vt100.color4: #0070FF
XTerm.vt100.color5: #B000B0
XTerm.vt100.color6: #00C0E8
XTerm.vt100.color7: #C0C0C0
XTerm.vt100.color8: #808080
XTerm.vt100.color9: #FF2000
XTerm.vt100.color10: #00E000
!XTerm.vt100.color10: #40B040
XTerm.vt100.color11: #FFFF00
XTerm.vt100.color12: #0090FF
XTerm.vt100.color13: #C000D0
XTerm.vt100.color14: #00D0FF
XTerm.vt100.color15: #FFFFFF

This sets the colors I want to use for a dark-themed 16-color xterm.
(I don't really use xterm any more just because the world has moved on
from Athena, so I don't have a config for the fancy 256-color
xterms... but it's the same idea.  You just need to sort out the
resource names for the colors you want to change.)

The first dot-separated part of the resource is the "class" of the
resource, in this case XTerm.  This is the default xterm resource
class, and so it will affect all xterms you start without other
command line arguments.  But, xterm lets you tell it what resource
class you want it to use!  This lets you do things like define an
entirely different color scheme, by just supplying a single
command-line argument to xterm.   So, for example, I *also* have
this in my .Xresources file:

/*  brown color scheme */
! XTerm.vt100.geometry: 80x24+1601+0
brown.vt100.foreground: black
brown.vt100.background: #D0C0A8
brown.vt100.titeInhibit:  true
! terminal colors 0-15 
brown.vt100.color0: black
brown.vt100.color1: #A00000
brown.vt100.color2: #005000
brown.vt100.color3: Yellow
brown.vt100.color4: DarkBlue
brown.vt100.color5: #700070
brown.vt100.color6: #006090
brown.vt100.color7: #848484
brown.vt100.color8: #505050
brown.vt100.color9: #B70000
brown.vt100.color10: #00A000
!XTerm.vt100.color10: #40B040
brown.vt100.color11: #FFFF00
brown.vt100.color12: #0050D0
brown.vt100.color13: #A000A0
brown.vt100.color14: #00B0FF
brown.vt100.color15: #FFFFFF

Lines that start with '!' are comments--TBH I have no idea why I have
color10 commented out in both profiles, but there you go.  You can
also use C-style comments, as I did at the start of the section.

NOTE:  I used "brown" here, but I would recommend using a class that
is more obviously unlikely to conflict with other programs--but since
virtually no one uses Xresources, or programs that use Xresources, any
longer, it probably doesn't matter terribly much what you use.

With both of those sets of resources defined in my .Xresources, I can
get my normal dark color scheme by just starting xterm normally:

  xterm &

Or I can get a brownish-themed xterm by starting it like this:

  xterm -class brown &

Weee!

HTH.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

Reply via email to