Support 0xRRGGBB colors on Write-Host
See original GitHub issueSummary of the new feature / enhancement
As a user I want Write-Host to support specifying full RGB colors on the -Foreground and -Background parameters.
I would also like to be able to specify any of the X11 named colors by name
Proposed technical implementation details (optional)
Instead of needing to write $($PSStyle.Foreground.FromRgb(0xa020f0))
into the string to set a purple color, I want to specify -Foreground A020F0
or -Foreground 0xa020f0
or -Foreground Purple
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:19 (8 by maintainers)
Top Results From Across the Web
Write-Host (Microsoft.PowerShell.Utility)
Specifies the text color. There is no default. The acceptable values for this parameter are: Black; DarkBlue; DarkGreen; DarkCyan; DarkRed; DarkMagenta ...
Read more >Write-Host with background colour fills the entire line ...
1 Answer 1 · 1 - Use Non-Breaking space character space at the end of line. · 2 - Use any character with...
Read more >PowerShell - How to format Write-Host with multiple colors
PowerShell method allowing to output a string in multiple colors. ... Write-Host "Whole text is in red with background Yellow" -ForegroundColor Red ...
Read more >Change font color in powershell output? - Uncategorised
I tried script like this but the font color in Ocotpus console is still default: write-host “Hello world!” -foregroundcolor “magenta”.
Read more >Powershell - write-host color not working
1. Try the following way: write-host -foregroundcolor "green" "Group " $GroupName " Successfully Added to " $Url $sourceFolder · 1. Are you sure ......
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
Definitely NOT. 😉
For three reasons:
@Jaykul FWIW I never said that all use of colour is bad.
However. We teach programmers that the job of programs is to print text on the console (e.g. Hello, World), and even when the programming task is scripting, not systems programming there is still a desire to print WAY too much : - one recent issue is to print the time to process the profile less often: I can judge fast enough or too slow, without knowing to the millisecond how long it took, I’m no more informed by the message being there , so why is it shown by default. Way too much that is printed (like the long hashes in your example) is nothing but chaff that the poor user needs to wade through.
The felony is compounded by Programmers who - with no particular skills in UI design being brought to bear on the problem - decide that we’d like our headings in green, or Zip files picked out in red or some such (or for an example on a recent issue, an external executable prints file names in dark magenta - a problem for Windows PowerShell on the default windows host).
It’s not always bad: git helps me see changes by using of colour, but in the colours git log are just what devs thought was a good idea at the time. Picking out warnings and errors is good, and what you’ve shown basically has two classes of “recede into the background” and one class of “Pay attention to this”. We’re better off with that. But the devs let lose with crayons kind of colouring in is something we should be spared.