Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

text colors in terminals (ls command)

94 views
Skip to first unread message

Bazza

unread,
Mar 4, 2023, 4:25:59 AM3/4/23
to
In Alma Linux 9, the ls command shows directories in dark blue, which is
hard to read. One can use ls --color=never to avoid this.
konsole seems broken: ls shows directories with 47m in front, e.g.
47mDownloads
I presume 47 is the code for dark blue.
ls command in terminal, xfce-terminal show the dark blue.
ye olde xterm seems best: off-white background, so directories are visible

In Debian, ls shows directories in blue, but no so stupidly dark as Alma.

Rob van der Putten

unread,
Mar 4, 2023, 4:41:37 AM3/4/23
to
Hi there
You can actually set the RGB values of each colour in ~/.Xresources.
E.G.:

*VT100*color4: rgb:00/44/ee
URxvt.color4: #0044ee
URxvt.color12: #5555ff

Then run xrdb -merge ~/.Xresources


Regards,
Rob

Grant Taylor

unread,
Mar 4, 2023, 12:27:17 PM3/4/23
to
On 3/4/23 2:25 AM, Bazza wrote:
> text colors in terminals (ls command)

Check the manual page for the `ls` command. Specifically the `LSCOLORS`
and `LS_COLORS` environment variables.

They specify which color numbers and features to use for various types
of entries.

As Rob pointed out, you can also redefine the actual RGB value of the
color numbers.



--
Grant. . . .
unix || die

Nuno Silva

unread,
Mar 5, 2023, 5:05:00 AM3/5/23
to
I think it was (U)Rxvt which would use the same color setting to
generate both a foreground and a background color, and led to situations
where I'd either have unreadable (too dark) blue text or a too bright
blue background. (This with colors set for light text on #000000.)

I also wonder if the GPU or the GPU driver could have any influence on
this: I recall noticing color differences in the blue between systems
that should be identical (configuration-wise) in that regard, but I
think I didn't investigate further - IIRC this was with blue text in
linux VTs.


> Then run xrdb -merge ~/.Xresources
>
>
> Regards,
> Rob
>

--
Nuno Silva

Rob van der Putten

unread,
Mar 5, 2023, 6:01:11 AM3/5/23
to
Hi there


On 05/03/2023 11:04, Nuno Silva wrote:

> On 2023-03-04, Rob van der Putten wrote:
>
>>
>> On 04/03/2023 10:25, Bazza wrote:
>>
>>> In Alma Linux 9, the ls command shows directories in dark blue,
>>> which is hard to read. One can use ls --color=never to avoid this.
>>> konsole seems broken: ls shows directories with 47m in front,
>>> e.g. 47mDownloads
>>> I presume 47 is the code for dark blue.
>>> ls command in terminal, xfce-terminal show the dark blue.
>>> ye olde xterm seems best: off-white background, so directories are visible
>>>
>>> In Debian, ls shows directories in blue, but no so stupidly dark as Alma.
>>
>> You can actually set the RGB values of each colour in ~/.Xresources.
>> E.G.:
>>
>> *VT100*color4: rgb:00/44/ee
>> URxvt.color4: #0044ee
>> URxvt.color12: #5555ff
>
> I think it was (U)Rxvt which would use the same color setting to
> generate both a foreground and a background color, and led to situations
> where I'd either have unreadable (too dark) blue text or a too bright
> blue background. (This with colors set for light text on #000000.)

I use xterm with 16 colours and gray90 (which is 229 229 229 or hex
E5E5E5) on black background.
16 colours means that there are two blues: 34 and high intensity, 1;34.
Vim with syntax highlighting on uses blue for remarks. The 'set
background=' (dark or light) statement in vimrc sets the use of high
intensity or normal colours.
I wanted to use normal intensity and this is where things get a bit
tricky; Langer areas are perceived brighter then thin lines. So a blue
that's OK for text may be too bright for backgrounds. It takes a bit of
tweaking to get things just right.

> I also wonder if the GPU or the GPU driver could have any influence on
> this:

That seems unlikely to me.
Individual monitors and their settings are more likely to make a difference.

Lew Pitcher

unread,
Mar 5, 2023, 11:14:23 AM3/5/23
to
For ls(1), you signal whether to use (or not) a colour palette by setting
the --color option. Often, a distribution will set (through the
/etc/profile script or one of the scripts in /etc/profile.d) an alias for
ls(1) that specifies --color=always. You can disable colourization by
altering or unsetting this alias, or specifying ls with the --color=none
option.

If you prefer ls(1) to colourize it's listing, but don't like the colours
it uses, you can change the colours to your liking. ls(1) determines how
to colourize from the value stored in the LS_COLORS environment variable.
The same /etc/profile script that sets the ls(1) alias often sets the
LS_COLORS envvar by eval(uating) the output of the dircolors(1) command.
You can /alter/ the colours used by ls(1) by changing the information
stored in the LS_COLORS envvar, or (more globally) by altering the
information output by the dircolors(1) command.

dircolors(1) /may/ use an input configuration file, but has a "database"
of colours compiled into it, to use if you do not specify a config file.
/If/ your setup uses dircolors(1) with a config file, you can alter the
contents of that config file to give you a more pleasing palette.
Otherwise, you may be stuck with the colour palette that dircolors(1)
was compiled with. It is worth noting that this colour palette maps
ls item types (directories, files, special files, etc) to specific
escape sequences /by/ terminal type, as each terminal (emulated or real)
may use different escape sequences for colourization. The colour
mappings may not be obvious from the escape sequences: read the doc
on the terminal /you/ use to ensure that you select the correct sequence.


HTH
--
Lew Pitcher
"In Skills We Trust"

Eli the Bearded

unread,
Mar 5, 2023, 5:23:11 PM3/5/23
to
In comp.os.linux.misc, Lew Pitcher <lew.p...@digitalfreehold.ca> wrote:
> For ls(1), you signal whether to use (or not) a colour palette by setting
> the --color option. Often, a distribution will set (through the
> /etc/profile script or one of the scripts in /etc/profile.d) an alias for
> ls(1) that specifies --color=always. You can disable colourization by
> altering or unsetting this alias, or specifying ls with the --color=none
> option.

As someone who logs into a lot of machines / VMs for figuring out what
went wrong before things get restarted, I loathe distros providing
"helpful" aliases by default. I want the tools to just be the tools.

Elijah
------
vim's no vimrc defaults fall in the same annoying category

Anthk

unread,
Mar 24, 2023, 11:39:14 AM3/24/23
to
I find the Tango colorscheme the nicest one for a balanced
color scheme. No more dark blues on black:

!
! Generated with :
! XRDB2Xreources.py
!
*.foreground: #ffffff
*.background: #000000
*.cursorColor: #ffffff
!
! Black
*.color0: #000000
*.color8: #555753
!
! Red
*.color1: #cc0000
*.color9: #ef2929
!
! Green
*.color2: #4e9a06
*.color10: #8ae234
!
! Yellow
*.color3: #c4a000
*.color11: #fce94f
!
! Blue
*.color4: #3465a4
*.color12: #729fcf
!
! Magenta
*.color5: #75507b
*.color13: #ad7fa8
!
! Cyan
*.color6: #06989a
*.color14: #34e2e2
!
! White
*.color7: #d3d7cf
*.color15: #eeeeec
!
! Bold, Italic, Underline
*.colorBD: #ffffff
!*.colorIT:
!*.colorUL:

Anthk

unread,
Mar 24, 2023, 11:39:14 AM3/24/23
to
alias ls='ls -F'

BTW, for ~/.Xdefaults or ~/.Xresources,
for XTerm or UXTerm.
here's a nice Tango colorscheme.

On xfce4-terminal, go to the settings
and choose the Tango colorscheme.
0 new messages