I've tried to create color schemes with https://terminal.sexy and http://ciembor.github.io/4bit/ but I can't get any of their exports to work with bash on Ubuntu on Windows.
What's the correct approach to customize the colors in boUoW?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI've tried to create color schemes with https://terminal.sexy and http://ciembor.github.io/4bit/ but I can't get any of their exports to work with bash on Ubuntu on Windows.
What's the correct approach to customize the colors in boUoW?
This is also a nice and easy solution, from https://medium.com/@iraklis/fixing-dark-blue-colors-on-windows-10-ubuntu-bash-c6b009f8b97c :
Append this to .bashrc
:
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
PS1='\e[37;1m\u@\e[35m\W\e[0m\$ ' # this will change your prompt format
And I found this useful too for vim's readability:
echo "set background=dark" >> .vimrc
The problem is not specific to bash on Ubuntu for Windows, as the terminal is still provided by conhost.exe
.
To change the colors, you can go into the Defaults:
And then you can click each individual color and change it to some other color.
The process is somewhat confusing, because by clicking a color rectangle, you're changing what is selected as the Screen Background. So you first have to change that selection, adjust the color and then change the selection back to your desired background color.
Overall, it is easier to just go with a different terminal or console emulator altogether. I personally use ConEmu now, which allows you to change color schemes much easier.
Screen Text
to black (0,0,0) and Screen Background
to some sort of light yellow (255,255,150) has worked pretty well for me. See sample screenshot.
Nov 20, 2016 at 3:01
2019 Solution:
The official ColorTool from Microsoft can be used to change the overall color scheme without having to set each color by yourself.
Just download the zip file (search for Color Tool <Month> <Year>
under Releases) and extract the tool to any folder. Then run it from your bash:
# run in wsl bash (or any other windows terminal)
# note that -x is required for wsl
./ColorTool.exe -x <scheme name>
# for the change to have permanent effect go to properties and click ok
Then you can easily import other color schemes in the iTerm format, by placing a .itermcolors
file in the schemes
folder of the ColorTool.
Same solution as the others with some more explanation for people like me (https://medium.com/@iraklis/fixing-dark-blue-colors-on-windows-10-ubuntu-bash-c6b009f8b97c)
cd /home/<user>
ls -a
You should find a .bashrc and make a BU
cp .bashrc .bashrcBU
add 2 lines
echo "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:';" >> .bashrc
echo "export LS_COLORS" >> .bashrc
before change vim also background to see correctly
echo "set background=dark" >> .vimrc
quit and restart
You then still have the path in the name with this strange blue color. You can modify this via PS1. Here the source (https://apple.stackexchange.com/questions/219125/is-there-a-way-to-change-the-font-color-of-the-current-path-in-termial)
echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
By me the balise [\033[01;34m]*[\033[00m] is the blue color so I change the color in pink [\033[01;34m]*[\033[00m]. To overwrite PS1
@EDIT:
You could do it this way, but it will not be permanent, and this variable will be deleted at the end of the session.
PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[00m\]\w\[\033[00m\]\$'
To make it permanent you have to write it to a file that will be loaded at the beginning of a session, like the precedent .bashrc.
echo "PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;35m\]\w\[\033[00m\]\$'" >> .bashrc
I don't think the UI lets you change all ANSI colors, you'd have to edit them via the registry.
There is already a solarized-dark theme that works quite well on https://github.com/neilpa/cmd-colors-solarized
(close/open the console window to activate)
You can use windows cmd's color customization to customize boW. Simply click on the small ubuntu icon in top right corner and click properties.
Also, to customize the prompt, you can use
export PS1="\e[0;31m[\u@\h \W]\$ \e[m "
which will change only the prompt to red and so on.
As such, colors seem to work fine on boW. The above sites won't work as they create config files for specific terminal emulators, but its just cmd here.
Also looking for a solution, found this SuperUser post then this post from MS Understanding Windows Console Host Settings
What it basically amounts to is all the settings are stored in the Shortcut file itself upon creation in the Start menu / Pinned to taskbar. Which can then be changed by modifying the properties.
Everything including colors can be customized in registry entry [HKEY_CURRENT_USER\Console\Git Bash] using properties outlined in the MS post, but to realize the change bash.exe must be executed directly by running "C:\Windows\System32\bash.exe" via Windows+R to force Windows to stop reading config in after the registry entries.
Once satisfied with the config, create new shortcut links in start and pin-to taskbar (if that's your thing).
Argument for doing it this way, is sweeping changes are easier to manage (say a new color scheme try out?) through .reg file than through tedious making and saving changes to a shortcut file.
What's the correct approach to customize the colors in boUoW?
As others have mentioned, .bashrc is usually your goto for adding the code.
The colors operate on 'escape sequences'. e.g. the sequence for Light Blue is \033[1;34m
The Linux Command Line book covers in detail changing color and format of prompt. Chapter 13: Custominzing The Prompt: Adding Color pg. 183
"Released under a Creative Commons license, this book is available for free download in PDF format."
Highly reccomended reading/reference for those who want to know more of the 'why' behind the CLI.
Alternatively :
It has some baked in color in the .bashrc if you uncomment a line, remove the '#' symbol.
Line 39: #force_color_prompt=yes
Either modify this file in Ubuntu nano or similar editor. Or using Windows, navigate to the folder (CAUTION: you can potentially screw things up in here.) C:\Users\"YourUserName"\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\root
and open the .bashrc file using Vim, emacs, notepad++, etc, to edit. Usually best to avoid using Windows Notepad, has been know to cause problems in the past.