$PSStyle cause issues in the PowerShell Console
See original GitHub issueSimple repro
Write-Verbose -verbose "verbose";Write-Output "out"
expected output
Actual results
VSCode reproduce
$PSVersionTable
$PSStyle.Formatting.Warning = $PSStyle.Background.Magenta + $PSStyle.Foreground.Yellow + $PSStyle.Bold + $PSStyle.Italic
Write-Warning "Colours!"
Expected behavior
and something like this:
Actual behavior
Notice the yellow:
Environment data
Name Value
---- -----
PSVersion 7.2.0-preview.2
PSEdition Core
GitCommitId 7.2.0-preview.2
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Using PowerShell with $PSStyle
Be aware that any changes to $PSStyle are not persistent unless you add them to your PowerShell profile script.
Read more >about Preference Variables - PowerShell
PowerShell includes a set of variables that enable you to customize its behavior. These preference variables work like the options in ...
Read more >Is it possible to stop `powershell` wrapping output in ANSI ...
This causes PowerShell to set $PSStyle.OutputRendering to PlainText on startup, which instructs PowerShell not to use VT / ANSI escape ...
Read more >Setting the Style in PowerShell 7.2 - TechGenix
PowerShell's newfound support for ANSI escape sequences allow you to ... You can use the $PSStyle variable to set the background color.
Read more >Change color of PowerShell 7 Get-ChildItem result
So to change file and directory colours, set the appropriate property in the $PSStyle.FileInfo object to the ANSI escape sequence representing ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we need a bit more platform-oriented thinking here
Hmm I can’t repro the color leaking.(Edit: Didn’t have the experimental feature enabled) As for the style not taking effect, yeah every custom host will need to implement this themselves.It would be nice if
ConsoleHost
was redesigned somewhat to be inheritable. That doesn’t really help PSES and such right now unless it’s polyfilled but it would save a lot of headache in the future.