53

How to change the dark blue in wsl (Windows Subsystem for Linux) to something brighter? Here is a picture of a config file opened with vim. I basically see a black screen. I cannot read it. And the property window of the console does not allow to change specific colors. Only the background and the main text.

enter image description here

1
72
  1. Start your WSL shell (for me that is ubuntu.exe)
  2. Right-click title bar and select "Properties"
  3. Pretty dumb dialog appears where you have to follow these steps
    • select the "Colors" tab
    • select "Screen Text" and note which color box got highlighted
    • select 10th color box where the dark blue color is
    • set rgb values to 59,120,255 (or your favorite blue)
    • select the color box noted in the first step
    • press OK

That will change the color in the console palette (used for example to highlight the cwd in the PS1 prompt). However the vim screenshot you provided uses the dark blue color directly and not trough the palette. To change colors in vim see https://unix.stackexchange.com/questions/88879/better-colors-so-comments-arent-dark-blue-in-vim.

6
  • While this works for changing one specific color there is an easy way to change the whole color scheme to more useful defaults. See my answer below. Just adding this note for people who don't scroll past the most voted answer ;-)
    – trs
    Jun 20 '19 at 1:17
  • 4
    You, sir, just saved the life of at least one keyboard. Thank you.
    – Birb
    Sep 25 '19 at 12:54
  • 1
    I can't believe I have gone for years trying to read that dark blue when it was this easy to fix. This answer should be selected because it precisely answers the question. (@trs I upvoted you too, but you answered a more general question) Oct 23 '19 at 14:19
  • Thank you, the best solution for me without adding or installing anything else :)
    – Soheyl
    May 13 '20 at 8:26
  • I'm using Windows Terminal and I can't right click the tab. Any ideas? Jul 26 '20 at 9:00
22

Edit

If you get here in 2021 and beyond:

Windows Terminal now has the option modify and define color schemes in "Settings (Ctrl+,)" -> "Color Schemes".

You can also select a different color scheme for each Profile in "Settings (Ctrl+,)" -> "[pick a Profile, e.g. Ubuntu]" -> "Appearance".

Original Post

There is already an answer that provides a solution to this specific question (change one color of the current scheme) but Microsoft also provides a more comprehensive solution.

You can update the colour scheme to another preset and define your own schemes / presets. They made the ColorTool and it is available on github: https://github.com/Microsoft/Terminal/tree/master/src/tools/ColorTool

When you download the zip file and extract it, there may already be a built .exe hidden in a subdir somwhere (terminal\src\tools\ColorTool\ColorTool\bin\Debug\net461\) and the schemes were in a different place. For me it was

C:\Users\[username]\Documents\GitHub\terminal\src\tools\ColorTool\ColorTool\bin\Debug\net461 C:\Users\[username]\Documents\GitHub\terminal\src\tools\ColorTool\schemes

Copy both the .exe and the schemes folder to the same place and run (for example):

ColorTool.exe -b campbell.ini

That's it :-)

More info on MS dev blog: https://devblogs.microsoft.com/commandline/introducing-the-windows-console-colortool/

If you cannot find the .exe in the specified path you can try building it from source. Other people can help with that :-)

2
  • this should be the answer. OneHalfDark scheme made all the colors well-contrasted and visible for me.
    – N K
    May 20 '20 at 22:27
  • 1
    ColorTool.exe -b OneHalfDark.itermcolors
    – progonkpa
    Sep 11 '20 at 10:49
6

Change your .bashrc file in your home folder.

EX: Replace the line start by LS_COLORS by this:

LS_COLORS='rs=0:di=1;35: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:.war=01;31:.ear=01;31:.sar=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:.webm=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:';
export LS_COLORS

You can find more here: https://medium.com/@iraklis/fixing-dark-blue-colors-on-windows-10-ubuntu-bash-c6b009f8b97c

3
  • While yes it's great that you can change ls and other programs to use a less annoying color, I think the question here was "how do you make the defined colors more readable". This does not provide a solution for 2 reasons: a) this needs to be defined for every single program and b) if for a legitimate reason another program prints blue output it will still be unreadable.
    – trs
    Jun 17 '19 at 13:18
  • Tried this, it did not work for me, but the answer from Zbyněk Winkler worked fine. This answer cannot hurt though, it does make things look generally nicer.
    – Contango
    Jun 21 '19 at 21:58
  • Where is the "home" folder? I've looked under C:/Users/[MyUserName]/ and there is no .bashrc file there. Am I looking in the right place?
    – Luke
    Aug 29 '20 at 10:08
2

I know right. The dark blue is SO hard to read on a black background.

On my WSL instance's bash terminal it is as simple as changing one character in one file; a file you already have more likely.

Edit vim ~/.bashrc

Look for the following at about line 60.

if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;32m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi

Following the then, edit the value of the PS1 variable.

Specifically changing what is for me the 89th character ...:\[\033[01;32m\]\w\... to ...:\[\033[01;33m\]\w\... will render the directory foreground text of the prompt in yellow.

Save, close vim, and the easiest way to test is to type bash<enter>. Then exit<enter> to return. Or close and reload your terminal window.

The value for this single character is the foreground color of the text that is, by enormously insightful default, dark blue on a black background.

Fun tip: The character just before this is background color of the same text.

I apologize to everyone for Microsoft's user interfering choices.

Don't forget to read the rest of the remarks in this .bashrc file. Someone obviously spent a lot of time thinking about the choices they made when constructing the file that everyone using WSL bash would have as a template.

1
  • This worked for me.
    – Canacourse
    Jan 28 at 12:31
2

For the vim editor as shown in the screenshot, use the set bg=dark command in .vimrc.

1

This is an addition to Zbyněk Winkler's answer. You can use the following colour scheme for a better looking WSL window.

  1. Open WSL.
  2. Right Click on the Title Bar and select "Properties".
  3. Goto the "Colour" tab.
  4. Update the 16 predefined colours to the following values (I know it's a bit tedious, but it's worth the effort):
    • Slot 1 RGB: (12, 12, 12)
    • Slot 2 RGB: (0, 55, 218)
    • Slot 3 RGB: (19, 161, 14)
    • Slot 4 RGB: (58, 150, 221)
    • Slot 5 RGB: (197, 15, 31)
    • Slot 6 RGB: (136, 23, 152)
    • Slot 7 RGB: (193, 156, 0)
    • Slot 8 RGB: (204, 204, 204)
    • Slot 9 RGB: (118, 118, 118)
    • Slot 10 RGB: (59, 120, 255)
    • Slot 11 RGB: (22, 198, 12)
    • Slot 12 RGB: (97, 214, 214)
    • Slot 13 RGB: (231, 72, 86)
    • Slot 14 RGB: (180, 0, 158)
    • Slot 15 RGB: (249, 241, 165)
    • Slot 16 RGB: (242, 242, 242)
  5. Click OK.

This will update your colours to a slightly lighter version of the existing colours.

Enjoy your new console.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.