Primeira coisa primeiro.
Usar o Write-Host tem sido um tópico muito debatido por um longo tempo. Mesmo pelo inventor / autor do PowerShell.
Write-Host Considered Harmful - by PowerShell founder Jeffrey Snover
https://jsnover.com/blog/2013/12/07/write-host-considered-harmful
When you are writing or reviewing PowerShell scripts, I’d like you to remember the following rule of thumb:
Using Write-Host is almost always wrong.
Write-Host is almost always the wrong thing to do because it interferes with automation. There are typically two reasons why people use Write-Host:
Existem muitos outros artigos sobre o assunto.
Nas versões anteriores do PoSH, o Write-Host não podia ser usado no pipeline, já que o momento yo usá-lo os dados se foram do buffer.
However, in PoSHv5 Jeffrey Snover now says...
With PowerShell v5 Write-Host no longer "kills puppies". data is captured into info stream
Description
The Write-Information cmdlet specifies how Windows PowerShell handles information stream data for a command.
Windows PowerShell 5.0 introduces a new, structured information stream (number 6 in Windows PowerShell streams) that you can use to transmit structured data between a script and its callers (or hosting environment). Write-Information lets you add an informational message to the stream, and specify how Windows PowerShell handles information stream data for a command.
Texto colorido na tela para informações sobre interação do usuário - até mesmo isso pode ser trabalhado facilmente.
Write-Verbose tem uma cor azul Write-Warning tem uma cor laranja
Você ainda pode usar cores, sem usar o Write-Host, fazendo isso ...
PowerTip: Write PowerShell Output in Color Without Using Write-Host
https://blogs.technet.microsoft.com/heyscriptingguy/2012/10/11/powertip-write-powershell-output-in-color-without-using-write-host
Summary: Write colorized output to the Windows PowerShell console without using the Write-Host cmdlet.
Em segundo lugar, você também não indica qual editor / console está usando. powershell.exe / powershell_ise.exe ou outra coisa, digamos, VSCode.
Agora, divulgação completa: não tentei isso no Bash. No entanto, sem gastar o tempo extra configurando a integração PoSH para Bash ...
Configuring the PowerShell ISE for use with Git and GitHub
The goal of this blog article is to configure the PowerShell ISE (Integrated Scripting Environment) so the management of Git version control can be performed from it. Most tutorials you’ll find will attempt to lead you down the path of using SSH instead of HTTPS to synchronize your repositories to GitHub from the command-line but that’s really over-complicated and unnecessary if you’re using a Windows based machine.
http://mikefrobbins.com/2016/02/09/configuring-the-powershell-ise-for-use-with-git-and-github
... então, o terminal bash e o console PoSH são dois ambientes diferentes. Se você está dizendo, que você está usando o comando Bash em um script PoSH e redirecionando a saída para o terminal Bash, então eu entendo isso, mas, fora do uso do Write-Host estar errado na maioria dos casos, quando PoSH envia saída para outra coisa, então é o destino que controla a aparência, não o PowerShell.
Mesmo usando PoSH WinForm / WPF, de caixas de texto pode ser enviado texto de PoSH, mas você deve usar as propriedades de para definir cores.
De qualquer forma, há várias discussões sobre cores no GIT Bash com o PowerShell. Veja se isso ajuda ainda mais.
Using Git from PowerShell
Customize your Git environment
You may want to customize some of the settings of your Git environment, especially if this is a new install of Git. Being a good project contributor in Git you should identify yourself so that Git knows who to blame for your commits. Also, I found that the default colors used by Git in the shell could be hard to read. So I customized the colors to make them more visible. For more information, see the Customizing Git topic in the Git documentation.
The following commands only need to be run once. You are setting global preferences so, once they are set, they are used every time you start a new shell.
https://seanonit.wordpress.com/2016/12/05/using-git-from-powershell
Setting colors for ls in git bash on windows
I have installed GitHub for Windows recently and am using the git bash prompt - the one thing that is bugging me right now is when I type LS all directories are listed in blue.
How do I change my git bash shell so that when I type LS the directories are listed in a different color to blue?
https://stackoverflow.com/questions/14049896/setting-colors-for-ls-in-git-bash-on-windows
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?
How do you change the color scheme in bash on Ubuntu for Windows?