PoshCode / Pansies

Powershell ANSI Escape Sequences, functions for colored output, etc.
MIT License
148 stars 14 forks source link

Default Foreground Color Gets Borked in ConEmu with Pansies #8

Closed zloeber closed 5 years ago

zloeber commented 6 years ago

I'm totally digging this module but seem to be running into an issue with the default color of output whenever I use it in conemu. The behavior has to do with the default host foreground color ($host.ui.rawui.foregroundcolor). If pansies is loaded I'm unable to change this value and so all output in some consoles (like conemu) get 'stuck'. Oddly enough a standard powershell console seems to render fine (as it adheres to the default colors in the registry instead of the host.ui color properties) but the underlying behavior is the same regardless which console is used, I cannot change $host.ui.rawui.foregroundcolor with this module loaded. I suspect that this may have to do with write-host being exported as a wrapper function but haven't dug into it yet.

Jaykul commented 6 years ago

The latest pre-release includes the ability to control the windows console colors (including the default foreground and background) in such a way that they affect the $Host.PrivateData and $Host.UI.RawUI as well ... however, I'm not sure I understand what you were describing here.

It is however, true that when you use Pansies, I change Write-Host to use ANSI sequences to change colors instead of the way the built-in one does it. Can you try using both side-by-side and screenshot it?

Microsoft.PowerShell.Utility\Write-Host "Hello World, what does this do?"
Pansies\Write-Host "Hello World, what does this do?"

For what it's worth, currently ConEmu does not work properly with extended colors (beyond 16) in Windows 10 (it actually works better with it's own ANSI support on older versions of Windows). I'm only using it part of the time because of that.

Jaykul commented 5 years ago

It's not PANSIES, it's PSReadLine (+ ConEmu) that's causing this. lzybkr/PSReadLine/#818

Try Update-Module PSReadline -AllowPrerelease