$Host.PrivateData colors are completely broken in PowerShell 7.2
See original GitHub issuePrerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
$PSStyle
has completely broken the PrivateData colors. Setting them no longer changes anything.
Expected behavior
The colors on `$Host.PrivateData` should affect the output
Actual behavior
Changes to `$Host.PrivateData` don't do anything anymore
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.2.0
PSEdition Core
GitCommitId 7.2.0
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
This is what I expected:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:16 (12 by maintainers)
Top Results From Across the Web
Changing PowerShell 7.2.2 color scheme to the default ...
1 Answer 1 ... by entering commands $host.PrivateData.[element name] = "[color code/name]" , $PSStyle.[element name] = "[color code/name]" and Set ...
Read more >Changing Verbose colors in PowerShell 7.2
But this isn't really changing the verbose colors, it's just forcing it to print directly to the console host as default text using...
Read more >Differences between Windows PowerShell 5.1 and ...
A new property ErrorAccentColor is added to $Host.PrivateData to support changing the accent color of the error message. The new Get-Error ...
Read more >Using PowerShell with $PSStyle
In this post, I show you how you can use ANSI rendering to control text decorations, such as color and font styling, in...
Read more >Fix powershell error colors
On the colors tab, change background to black, and text to very light gray, reverse for selected text. And most important, look at...
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 Free
Top 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
So, bottom line: you added a new, non-host way of injecting virtual terminal escape sequences for the same purposes that already existed in the host, and then changed the default host so that if it thinks it’s running in a terminal that supports escape sequences … it just ignores it’s own settings.
Is that right? Is backward compatibility just out the window forever?
@Jaykul that is also an option. The only problem is if then the user updates
$PSStyle
, it would not be possible to reflect that back intoPrivateData
unless they happen to use one of the 8 colors only. It might just be something that gets documented and could be ok.