- Programster’s Blog
- Tutorials focusing on Linux, programming, and open-source
- Fix Font Colors In Windows 10 Bash
- Fixing Folder Colors
- Adjusting the Prompt
- Alternative PS1
- Fixing VIM Colors
- How do you change the color scheme in bash on Ubuntu for Windows?
- 7 Answers 7
- How to change RGB colors in Git Bash for windows?
- 9 Answers 9
- In Git Bash on Windows 7, Colors display as code when running Cucumber or rspec
- 7 Answers 7
- Bash for Windows colors are unreadable with default terminal theme #7556
- Comments
- Tyriar commented Jun 11, 2016
- karlti commented Jun 12, 2016
- Tyriar commented Jun 12, 2016
- karlti commented Jun 12, 2016
- Tyriar commented Jun 12, 2016
- isareds commented Jul 5, 2016
- jakubsuchybio commented Jul 15, 2016
- Tyriar commented Jul 15, 2016
- jakubsuchybio commented Jul 15, 2016
- Tyriar commented Jul 15, 2016
- bear0330 commented Oct 23, 2016
- Tyriar commented Oct 23, 2016
- isareds commented Oct 25, 2016
- PhilT commented Nov 18, 2016 •
- laktak commented Nov 18, 2016
- lcapelluto commented Jan 20, 2017
- dbaeumer commented Jan 26, 2017
- SoumyaChatterjee commented Feb 19, 2017
- Tyriar commented Feb 19, 2017
- passthejoe commented Jun 6, 2017
- tobia commented Jun 18, 2017 •
Programster’s Blog
Tutorials focusing on Linux, programming, and open-source
Fix Font Colors In Windows 10 Bash
Below are steps you can take to improve your experience of using the BASH shell in windows 10. This tutorial’s content is taken from Medium — Fixing dark blue colors on Windows 10 Ubuntu bash, but I felt the need to «redo» the post to fix issues with the commands/steps not working because the characters like apostrophes and semicolons are substituted to other characters due to Medium’s steps to prevent code injection attacks. You should be able to copy/past the text/commands from this post without issue.
Fixing Folder Colors
By default, the colours in windows 10 BASH shell are so terrible it’s pretty hard to read the folder names. To fix this append the following two lines to your $HOME/.bashrc file.
Adjusting the Prompt
If you don’t like having the full path of where you are (e.g. the output of pwd ) in your prompt, then you can fix this by appending the following line to your $HOME/.bashrc file.
After performing the steps above, BASH in windows will look something like below:
Alternative PS1
Marcos Santiago provided the following alternative value for PS1 in the comments, which you may prefer:
Fixing VIM Colors
Also, the default colors in VIM make it near impossible to read comments. You can fix this by executing the following command:
The result will be that editing your .bashrc file in vim now will look like below:
How do you change the color scheme in bash on Ubuntu for Windows?
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?
7 Answers 7
Append this to .bashrc :
And I found this useful too for vim’s readability:
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.
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 under Releases) and extract the tool to any folder. Then run it from your bash:
Then you can easily import other color schemes in the iTerm format, by placing a .itermcolors file in the schemes folder of the ColorTool.
You should find a .bashrc and make a BU
before change vim also background to see correctly
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)
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.
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.
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
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.
How to change RGB colors in Git Bash for windows?
I’m using the Git Bash in Windows and for the purposes of my custom git log format, I’d like to modify the terminal’s exact RGB color values so I can fine-tune the color outputs. My git log format is as follows in my global .gitconfig :
I’d like to define in Git Bash what RGB value actually maps to ‘blue’, for example. Any idea how I can do this? Step by step instructions would be wonderful. Thanks in advance.
I setup my .bashrc and it isn’t working for some reason. Colors aren’t changing :-(. Here is a script I ran to see colors: http://pastebin.com/9EsYmGCj and the result: http://i.imgur.com/1dJ3o1a.png
9 Answers 9
This works for me to change the text colors used by Git Bash on Windows 7:
- Click on the upper left corner of an open Git Bash window (the Git icon in the window frame).
- A menu appears (the same that would appear with a regular DOS cmd Window). Choose the last entry: «Properties»
- Go to tab «Colors»
- Choose radio button «Screen Text»
- Remember which color is currently assigned to «Screen Text» in the row of small color boxes (it has a black frame).
- Then select the color you want to change by clicking on the corresponding color box. This color is now assigned as «Screen Text», which is what Git Bash uses for regular text. But don’t worry, this change is only temporary and needed to modify the value of a color.
- Now change the Red/Green/Blue values for the selected color. In my case I wanted to make the fifth color from the left (much) brighter. Let’s call it «Color 5». This is the color Git Bash uses to show changed files with «git status». Whenever Git Bash wants to use «Color 5» it will use the new RGB value.
- «Screen Text» is now still set to «Color 5». So click on the original color that you have remembered.
The changes made in this way are permanent but only valid for the shortcut you have used to start Git Bash. If you create a new shortcut you are back to the original colors.
In Git Bash on Windows 7, Colors display as code when running Cucumber or rspec
In Git Bash on Windows 7, I occasionally have something happen that causes the color coding to fail when running cucumber scenarios or rspec specs.
Occasionally, it is randomly fixed (where randomly == I don’t know what I did to cause it to be fixed).
instead of seeing this in color:
I see something like:
I know these are the code representations of the colors, but I don’t know why it stops displaying the colors nor do I know how to fix it. What am I missing?
Output from git config —list:
7 Answers 7
On windows, git Bash uses the built in terminal which is rolled into the cmd prompt. If you install cygwin you can use the mintty terminal emulator (Installed on the start menu as «Cygwin Terminal»).
Why is this important? Because the windows cmd prompt term does not interpret ANSI escape sequences. It uses M$ color control scheme instead. If the program you are using does not switch to this scheme on windows, or go through a filter, then you will see the raw escape characters. Cygwin’s mintty console has full support for these codes.
If the colors usually work, this is a bug in cucumber/rspec from porting. Somebody missed a check for windows when printing the colors or something. Until this gets fixed, a work around is the following python script:
You will need to install the colorama library for this. Then just pipe your output through the script:
Bash for Windows colors are unreadable with default terminal theme #7556
Comments
Tyriar commented Jun 11, 2016
|
Steps to Reproduce:
- Add setting «terminal.integrated.shell.windows»: «\\WINDOWS\\sysnative\\bash.exe»
- Open terminal
The text was updated successfully, but these errors were encountered:
karlti commented Jun 12, 2016
this is a Linux bash setting, and not vscode/terminal related.
this gives you bold (01) cyan (36) dir names with black (40) background
hope this helps.
/*Karl
Tyriar commented Jun 12, 2016
The colors are LS_COLORS but the color set is defined in vscode.
karlti commented Jun 12, 2016
I think, these are the default colors as defined in dircolors in bash itself.
when I print out dircolors in bash directly, I get » ow=34;42 «, that is green background (42).
when I change globally the colors in my standalone terminal, vscode does not adopt that, so you are correct.
I am nearly a complete noob in Linux, but wouldn’t it be the best to define some ‘batch’ with LS_Colors defined and other goodies and run that when you toggle the integrated terminal?
Tyriar commented Jun 12, 2016
@karlti I’d prefer not to mess with the user’s current configuration, rather try tweak the colors so they don’t look so bad with the defaults.
isareds commented Jul 5, 2016
To solve this problem simply open the normal bash on ubuntu on Windows then type in order:
/.bashrc to open the default «setting» of the ubuntu bash.
I solved in this way the problem. Adding this line not change by default the «theme» of the bash, but you can use it only when you are using the bash on ubuntu on Windows in Code.
jakubsuchybio commented Jul 15, 2016
Ah thanks. That alias worked like a charm. However is there any way to call that alias every start when bash is initialized in vscode?
Tyriar commented Jul 15, 2016
@jakubsuchybio you can probably just add the script to your
So you just run it without setting up the (manual) alias.
jakubsuchybio commented Jul 15, 2016
Thanks! I was under impression, that .bashrc was overwritten by vscode somehow. But no, this works.
Tyriar commented Jul 15, 2016
@jakubsuchybio nope, any commands you want to run on startup just put them in your
bear0330 commented Oct 23, 2016
Can I change background color for terminal window only? Thanks.
Tyriar commented Oct 23, 2016
@bear0330 not currently, these are the relevant issues: #6979, #3112, #13534
isareds commented Oct 25, 2016
Inside visual studio i don’t think you can. Using the normal bash you can!
Il 23 Ott 2016 12:16 PM, «Bear Huang» notifications@github.com ha scritto:
Can I change background color for terminal window only? Thanks.
PhilT commented Nov 18, 2016 •
You can also write the above as: export LS_COLORS=»ow=01;36;40″
laktak commented Nov 18, 2016
One workaround (or the only one that really worked for me) is to install the solarized-dark theme from https://github.com/neilpa/cmd-colors-solarized (close/open the console window to activate)
This also fixes the colors for git&others.
lcapelluto commented Jan 20, 2017
where is «ow» referenced? Everything else online says to use «di», but I’m using bash on windows, and I could only change the directory colors using «ow». Now I can’t find the parameter that will work to change file colors instead of «fi».
dbaeumer commented Jan 26, 2017
Looks better but still not perfect.
SoumyaChatterjee commented Feb 19, 2017
How to code in visual studio code using bash for windows? and also any way to change syntax highlighting for C, C++ in bash for windows?
Tyriar commented Feb 19, 2017
Read about bash on windows and/or vim if that’s what you’re using to change highlighting.
passthejoe commented Jun 6, 2017
Just in Vim, you can:
or put it in your .vimrc
This make the syntax highlighting in Vim look a lot better.
tobia commented Jun 18, 2017 •
I just created a REG file to set the default console colors to be the same as the default XTerm colors:
If you want to edit it, notice that the numbering of entries (ColorTableXX) and the ordering of RGB values is a bit wacky. Here is what it looks like with the colortest-16 utility:
This should be enough to get most Linux utilities to look OK.
Please note that if you’re launching your windows from a link, such as a program pinned to the taskbar, you may have to recreate the link (or unpin the program, close it, and pin it back) in order to use the updated color scheme.
I’m not sure Microsoft would want to use this as the default color scheme for all console windows, because many tools expect the colors to be those of VGA DOS. But if you use Linux tools more than DOS ones (if at all) then you might want to use something like this.