28

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

33
  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 "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.

| improve this answer | |
  • 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
  • 1
    You, sir, just saved the life of at least one keyboard. Thank you. – Birb Sep 25 '19 at 12:54
  • 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) – foobarbecue Oct 23 '19 at 14:19
  • Thank you, the best solution for me without adding or installing anything else :) – Soheyl May 13 at 8:26
8

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 :-)

| improve this answer | |
  • this should be the answer. OneHalfDark scheme made all the colors well-contrasted and visible for me. – N K May 20 at 22:27
4

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

| improve this answer | |
  • 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
1

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.

| improve this answer | |

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.