[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: vtty & X terminal color scourge



On Wed, 5 Apr 2023 davidson wrote:
On Tue, 4 Apr 2023 Greg Wooledge wrote:
On Tue, Apr 04, 2023 at 10:33:26PM -0400, Felix Miata wrote:
What bothers me more than anything is that dead symlinks haven't
been red, or anything else to distinguish them, in a long time.
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So... you're talking about the colors used by "ls", yes?

If you don't want ls colors at all, you can use "ls --color=never".
You can set that up as an alias/function.

If you DO want colors, just not the ones you're currently getting,
then you need to look at the LS_COLORS environment variable.
[trimmed interesting stuff about dircolors]

My reading of the OP is that his ls output is not colorised, and he
probably does *not* want to hand-roll some custom color semantics. He
just wants to enable the behavior he remembers.

TLDR: I ate some dog food and it tasted to me like Felix probably does
need to do some hand-rolling after all.

So I open an xterm and enter

 $ setterm --background blue --foreground white --bold on --store
 setterm: terminal xterm does not support --store

and hit Ctrl-L. Blue sky, white fluffy characters.

With a foreboding sense of doom, I then cd to a directory with a
broken link and try

 $ ls --color=auto

and get .... eww.

The attributes are reset. Everywhere that gets redrawn is reset to my
defaults (steelblue1 on black, and no bold). And with a second Ctrl-L
the darkness is complete.

Then I re-read the man page for setterm

 --store
       Stores the terminal's current rendering options (foreground and
       background colors) as the values to be used at
       reset-to-default.  Virtual consoles only.
                          ^^^^^^^^^^^^^^^^^^^^^

It does indeed work fine in a VT. But the default foreground color
(bold blue?) for directories is unfortunate, given Felix's background
color. (Adding -p to ls helps a little...not enough)

If I launch an xterm with

  $ lxterm -bg blue -fg white

then there's no need to use "setterm --store" to fix the rendering
defaults for background/foreground. White-on-blue is then the default
and the "ls --color=auto" test succeeds, modulo the unfortunate
default directory foreground color.

As for setterm's "--bold on", I don't know whether there are
equivalent xterm switches.

--
Hackers are free people. They are like artists. If they are in a good
mood, they get up in the morning and begin painting their pictures.
-- Vladimir Putin


Reply to: