Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have a problem with dark-blue color in vim or ls output. Because I'm using black background color, words colored in dark-blue are almost completely invisible. How can I address this problem?

share|improve this question
possible duplicate of Overriding the shade of color displayed –  Gilles May 16 '11 at 11:43
The other thing you can do is change the colors themselves. None of the colors (even the 'dark' ones) are supposed to be unreadable on a black background. If you could specify what terminal you are using, more information could be provided if the linked question doesn't already help with this. –  Random832 May 16 '11 at 13:35
This looks like a problem with some displays or video card outputs. This default blue (that seems to be at least more or less the same in the linux console and in some terminal emulators) is readable on some displays, and unreadable on others. –  njsg Apr 4 at 12:03

4 Answers 4

up vote 27 down vote accepted

You can modify the color theme of vim with the background option. Use

set background=dark

in your current session or set it permanent in your vimrc.

The output of ls is configured with /etc/DIR_COLORS. See the manpage for more information. The settings can be overwritten with a ~/.dir_colors (On Ubuntu: ~/.dircolors - see entry in ~/.bashrc) file in your home directory.

An entry like

 DIR 01;36 

will produce a more readable background with cyan.

share|improve this answer
Thanks, perfectly working for ls. –  user7477 May 16 '11 at 11:52

Rather than configure applications to avoid blue on black, I recommend configuring your terminal to make the blue more visible. Most terminal emulators have a setting for that. In xterm, there's an X resource:

XTerm.VT100.color4: CornflowerBlue

In other terminal emulators, look in the configuration file or dialog for color settings or themes.

There is a common control sequence to set the shade associated with a color number from the application: OSC 4 ; c ; spec BEL where OSC is ESC ], c is the color number and spec is a color spec such as #RGB.

printf %b '\e]4;4;#6495ed\a'  # set the blue shade to CornflowerBlue

A change by the application is only effective until the next terminal reset. If you use this method (only recommended if your terminal lacks a configuration mechanism), to make the change effectively persistent, append the color configuration escape sequence to your terminal's reset string (termcap: r1 string; terminfo: rs1 string).

See also Overriding the shade of color displayed, Can I set my local machine's terminal colors to use those of the machine I ssh into?.

share|improve this answer
sounded like a lame suggestion at first, but considering that I can't read half the dark colors and none of my programs use solid background colors where dark might be reasonable, this actually makes a lot of sense! –  M Conrad May 7 at 22:41

A faster way to set the ls directory color for your terminal session:

1. Open your terminal run the dircolors command:

machines@box790 ~ $ dircolors
export LS_COLORS
machines@box790 ~ $ 

It's parroting you the command for you to set the colors for ls. The 'di' stands for directory. 34 is the bad dark blue. 36 is cyan. So lets paste it, and change it into the terminal.

2. Copy that whole thing into the terminal, making a single change

You change the di=01;34 to di=01;36 like this:

machines@box790 ~ $ LS_COLORS='rs=0:di=01;36:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:';

machines@box790 ~ $ export LS_COLORS

3. This sets the directory colors to cyan immediately

do an 'ls' and see that directories are indeed cyan.

4. Make the above step permanent

Make it permanent by placing the above commands at the bottom of your ~/.bashrc like this:

export LS_COLORS

If you put this into your ~/.bashrc and (restart the terminal or source ~/.bashrc), the colors should still be right.

share|improve this answer
The color scheme for dircolors can be saved in a human-readable file, and applied from bashrc with eval "dircolors -b ~/.dir_colors". See here colorscheme examples. –  alexei Sep 19 at 2:41

If you inform vim that you are using a black background (or otherwise dark theme) it will lighten up all the colors so they are readable:

:set bg=dark
share|improve this answer
Thanks, it works like a charm for vim. –  user7477 May 16 '11 at 11:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.