Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Fix hard-to-read colors in xterm UNIX
I like running my xterms with a black background. I found that whenever a dark-blue color is used inside an xterm on my Mac, it is extremely hard to read for me. The same is not true on my Linux-based laptop -- there I don't have any trouble seeing the blue. If you are not sure whether you have this problem, but know what a .cshrc or .tcshrc file is, try running:
 emacs -nw ~/.cshrc
If you have trouble making out the color-coded setenvs, then read on. I did a man xterm and found out that you can change the default colors displayed in an xterm. To do this, however, you have to modify your .Xresources file. Open it up in your favorite editor:
 emacs ~/.Xresources
Then add these two lines:
 XTerm*color4: royalblue
 XTerm*color12: lightblue
Save the file and exit the editor. For the changes to take effect, either restart X11 or type xrdb ~/.Xresources. When you type the above code, only new windows will be affected by the changes -- old xterms you created before running xrdb will be unaffected.

Inside a newly created xterm, run the program that was giving you trouble to see the changes. If there are other colors that bother you, read the colors section in man xterm to find out which color numbers to remap. Finally, how did I find the names royalblue and lightblue? Right here.
    •    
  • Currently 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[10,270 views]  

Fix hard-to-read colors in xterm | 13 comments | Create New Account
Click here to return to the 'Fix hard-to-read colors in xterm' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fix hard-to-read colors in xterm
Authored by: nmk on Jul 12, '04 08:21:38AM

How would one go on to change the colours for directories and so on displayed in Terminal.app running a bash shell?



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: mivok on Jul 12, '04 09:10:19AM

TerminalColors should do the job - http://culater.net/software/TerminalColors/TerminalColors.php



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: Handycam on Jul 13, '04 04:47:33PM

IMO the Terminal Colors plugin is harder than just adding the definition to your .bash_profile

For one thing, in the inspector for Terminal Colors, what is what? It has a lot of swatches but no labels for any of them. Unless I'm missing something...



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: mivok on Jul 15, '04 11:13:42AM

What setting in .bash_profile? The LSCOLORS (or LS_COLORS) mentioned elsewhere in this thread works fine for directory listings, but is useless everywhere else where colours are used.



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: spoier on Jul 12, '04 01:20:16PM

"man ls" and look for LSCOLORS env variable

Mine is LSCOLORS=gxfxcxbxdxegedabagacad

Skye



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: sell5311 on Jul 14, '04 01:58:17AM

This hint addresses a long-standing issue with terminal. Thanks for the tips!

However, setting LSCOLORS in .bashrc doesn't seem to help (colors remain the same dark blue). Tried LS_COLORS as well. Note: my 10.3.4 environ may be complicated by a Fink install: my default "ls" is actually:
$ ls --version
ls (fileutils) 4.1
Written by Richard Stallman and David MacKenzie.

/bin/ls doesn't provide version info, but running this Apple-supplied binary doesn't provide any colors at all.



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: rwmitchell on Jul 14, '04 05:43:14AM

I have LS_COLORS, not LSCOLORS. I also use both:

ls (coreutils) 5.0
Written by Richard Stallman and David MacKenzie.
Copyright (C) 2003 Free Software Foundation, Inc.

and

dircolors (coreutils) 5.0
Written by H. Peter Anvin.
Copyright (C) 2003 Free Software Foundation, Inc

dircolors will optionally read a config file so that you can set whatever color tags you want for many different file types. The color settings work fine with terminal.app.



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: Cerberus on Jul 16, '04 04:20:07PM

This is not true - you need to have your terminal announce itself as xterm-color, not xterm, then ls -G will colorize your screen. Once you can get your terminal.app (and/or ssh etc) to say it is an xterm-color screen, then to make colorization permanent, make an alias to ls = ls -G (Like this)

alias ls='ls -G'

I will look around for the code i used to make this permanent (I think it was in the .login for bash but cannot find it now, so maybe it was in the rc's?)

What I like about this change is then you do not have questionably available binaries running on your system (well, you never truly know)



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: zojas on Jul 16, '04 05:16:23PM
terminal.app is more accurately described as dtterm, rather than xterm-color. then of course, if you run an actual xterm, you will want xterm-color.

I put this in my ~/.zshenv file. for bash, it would probably be best in ~/.bash_login


if [[ $TERM == 'vt100' ]]
then
  export TERM=dtterm
  #export TERM=xterm-color
elif [[ $TERM == 'xterm' ]]
then
  export TERM=xterm-color
fi
also, I have only /bin/ls. I aliased my ls like this:

alias ls='ls -FvG '
if you wanted to run apple's ls rather than the one in coreutils from fink, change the ls alias like this:

alias ls='/bin/ls -FvG'
I set my LSCOLORS like this:

export LSCOLORS='Fa'


[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: Cerberus on Jul 17, '04 04:50:34PM

That is funny. I posted this info on Apr 11 here and stated that I had to make ZERO changes under 10.3.3. So it might be that apple fixed the terminal for us? I made the same statements I made above (ls -G to enable color output)

http://www.macosxhints.com/article.php?story=20020408225741777

but the point here is that if you are on the recent verions of 10.3 (seemingly .3 or .4) then there is NO NEED to hack away at seeing colors. But as an aside, the blue that we are all after changing is horrible to look at (it is ugly with my/this hint so I have to do something about it!)



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: Cerberus on Jul 17, '04 06:35:11PM

And as a final coment to this I found this online (google'd it) and it looks great. Makes the colors nice and bright (instead of dingy and dark) and hilights things very well.

export LSCOLORS=ExFxCxDxBxegedabagacad

put it in your .profile, like all these other comments say ;-P



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: mivok on Jul 12, '04 09:12:39AM

The colour names can also be found in the file /usr/X11R6/lib/X11/rgb.txt



[ Reply to This | # ]
Fix hard-to-read colors in xterm
Authored by: neier on Jul 12, '04 09:32:48PM
It is better to do xrdb -merge ~/.Xresources

Without the -merge option, then ONLY the defaults which are explicitly listed in your .Xresources file will be applied. The -merge option keeps the old values, and overwrites the ones listed in the .Xresources file.

[ Reply to This | # ]