terminal: In terminal emulators, bash fails to render correct background color
From @Elderry on July 17, 2017 8:2
My Windows build number: Microsoft Windows [Version 10.0.15063]
It seems that in many terminal emulators, after running a command that outputs colors to the terminal using bash, the background will become a strange gray or black. But the default Windows Console doesn’t has this problem. Here are the examples:
Integrated Terminal of Visual Studio Code:
Integrated Terminal of Intellij IDEA:
Default Windows Console:
To provide more detail, here is my bash prompt:
BLUE='\e[1;34m'
GREEN='\e[1;32m'
RESET='\e[0m'
source $HOME/Projects/Personal/posh-git-sh/git-prompt.sh
PROMPT_COMMAND='__posh_git_ps1 "" "${BLUE}\w\n${GREEN}\u@\h${RESET} > "'
Copied from original issue: Microsoft/WSL#2344
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 18 (13 by maintainers)
Thanks @Elderry for confirming that this is fixed in 1803.
I’m going to close this as resolved, @miniksa is right about the 256 color stuff.
Correct, our API
ReadConsoleOutput
and friends doesn’t provide the ability to read this information out of the screen buffer. VSCode uses WinPTY which scrapes this information out of our buffer with the console APIs.We’ve been focusing on #57 instead to allow 3rd-party terminals to receive this information on a standard PTY stream like other platforms instead.