JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.79k stars 2.35k forks source link

Colors are not rendering (Git Bash - Windows 10) #1578

Closed LukeIsHereToDevelop closed 2 years ago

LukeIsHereToDevelop commented 2 years ago

Code of Conduct

What happened?

I don't know why but the colors are not rendering. I'm using Git Bash on Windows Terminal.

Image

Also, I don't know if it is an useful information, but:

Immagine 2022-01-14 150306

The debug command correctly renders the segments.

Theme

The default one. (I tried with bubbles too)

What OS are you seeing the problem on?

Windows

Which shell are you using?

bash

Log output

2022/01/14 14:36:31 debug: getenv
C:\Users\Luca\AppData\Local
2022/01/14 14:36:31 getenv duration: 0s, args: LOCALAPPDATA
2022/01/14 14:36:31 getCachePath duration: 0s, args:
2022/01/14 14:36:31 getArgs duration: 0s, args:
2022/01/14 14:36:31 getArgs duration: 0s, args:
2022/01/14 14:36:31 getShellName duration: 0s, args:
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/01/14 14:36:31 isRunningAsRoot duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getPathSeperator duration: 0s, args:
2022/01/14 14:36:31 getPathSeperator duration: 0s, args:
2022/01/14 14:36:31 getShellName duration: 0s, args:
2022/01/14 14:36:31 getCurrentUser duration: 0s, args:
2022/01/14 14:36:31 getHostName duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: SSH_CONNECTION
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: SSH_CLIENT
2022/01/14 14:36:31 getCurrentUser duration: 0s, args:
2022/01/14 14:36:31 getRuntimeGOOS duration: 0s, args:
2022/01/14 14:36:31 getHostName duration: 0s, args:
2022/01/14 14:36:31 isRunningAsRoot duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getArgs duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getRuntimeGOOS duration: 0s, args:
2022/01/14 14:36:31 getRuntimeGOOS duration: 0s, args:
2022/01/14 14:36:31 getPathSeperator duration: 0s, args:
2022/01/14 14:36:31 getPathSeperator duration: 0s, args:
2022/01/14 14:36:31 getPathSeperator duration: 0s, args:
2022/01/14 14:36:31 getRuntimeGOOS duration: 0s, args:
2022/01/14 14:36:31 stackCount duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getRuntimeGOOS duration: 0s, args:
2022/01/14 14:36:31 hasCommand duration: 20.5817ms, args: git.exe
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 error: hasParentFilePath
CreateFile C:\.git: Impossibile trovare il file specificato. (translated: cannot find the specified file)
2022/01/14 14:36:31 hasParentFilePath duration: 998.1µs, args: .git
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: VIRTUAL_ENV
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: CONDA_ENV_PATH
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: CONDA_DEFAULT_ENV
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: PYENV_VERSION
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 debug: getenv

2022/01/14 14:36:31 getenv duration: 0s, args: JAVA_HOME
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getBatteryInfo duration: 3.5218ms, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 executionTime duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 isRunningAsRoot duration: 0s, args:
2022/01/14 14:36:31 getcwd duration: 0s, args:
2022/01/14 14:36:31 getPathSeperator duration: 0s, args:
2022/01/14 14:36:31 getPathSeperator duration: 0s, args:
2022/01/14 14:36:31 getShellName duration: 0s, args:
2022/01/14 14:36:31 getCurrentUser duration: 0s, args:
2022/01/14 14:36:31 getHostName duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@LukeIsHereToDevelop weird, there's zero difference in rendering when it comes to non-debug and debug. There seem to be others experiencing this issue as well, adding the following to .bashrc seems to do the trick.

export FORCE_COLOR=true
bradleylandis commented 2 years ago

I'm having the same problem on ZSH/MacOS 12.1.

This was in Terminal. The colors look fine in iTerm 2.

JanDeDobbeleer commented 2 years ago

@bradleylandis yes, Terminal doesn't come with color support out of the box. That's also mentioned in the docs.

LukeIsHereToDevelop commented 2 years ago

Hmm, I tried with export FORCE_COLOR=true and export FORCE_COLOR="1", but it still doesn't work. I think I'll temporarily switch to PowerShell (it works perfectly on it) because Oh My Posh seems so cool to see haha.

JanDeDobbeleer commented 2 years ago

@LukeIsHereToDevelop did you also try updating git? Seems like we have some issues on older versions.

This also popped up:

Click next until you'll prompt to choose to Configure the terminal emulator to use with Git Bash, here you select Use Windows default console window (instead of the default option which use MinTTY as terminal emulator)

And this one (which is different compared to what you tried, see Windows system variable):

Was helped in another thread - Created a windows system variable FORCE_COLOR and had it set to true, did not restart, and now I have colors in Git Bash (windows 7)

JanDeDobbeleer commented 2 years ago

@LukeIsHereToDevelop what's the output of curl -s https://gist.githubusercontent.com/HaleTom/89ffe32783f89f403bba96bd7bcd1263/raw/ | bash

It should render colors correctly, if not it's an issue with either your setup/git bash version (but not oh-my-posh).

image

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.