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?

  • possible duplicate of Overriding the shade of color displayed May 16 '11 at 11:43
  • 2
    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 '15 at 12:03

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.

  • For those new to bash: after creating your file (e.g., ~/.dircolors) as directed here, you just have to source ~/.bashrc to see it working. Thanks for this answer!
    – Marcus
    Oct 11 '19 at 16:31

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?.

  • 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 '15 at 22:41
  • Solarized (ethanschoonover.com/solarized) has nice color schemes for various terminal emulators and other programs.
    – David
    Feb 23 '16 at 16:24

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.

  • 3
    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 '15 at 2:41
  • now my symlink is the same color as dir
    – ealeon
    Sep 16 '19 at 17:15
  • @ealeon Ah, it does appear that directories di and symlinks ln have the same color as 01;36. Feel free to switch up those colors, if that particular distinction is important to you. This colorscheme is a default one I found kicking around. Sep 16 '19 at 17:26

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

This will load the ls colours for the current shell, replacing blue with cyan.

eval `dircolors | sed -e 's/;34:/;36:/'`

It sets the environment variable LS_COLORS.


Using xfce4-terminal I struggled with this problem for a long time until it really broke my work.

I found out, that one can change the representation for the different colors in the "Palette" in the "xfce4-terminal"-settings. So that dark-blue would be represented as light-blue or anything else that fits your background-color. See screenshot: enter image description here


for me this work best:

LS_COLORS=$LS_COLORS:'di=0;44' ; export LS_COLORS

enter image description here

  • Welcome to the site, and thank you for your contribution. Would you mind editing your post to show the OP how to make this change persistent among all shells and across reboots?
    – AdminBee
    Jul 10 '20 at 11:33

Run dircolors, you will see something like di=01;34. Here, 01 means bold. So you just need to change it to 00, which means default color. You could add

eval `dircolors | tr 01 00`

in your .bashrc.

I use MobaXterm and it works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy