Enhancement Proposal - Add -ForegroundColor & -BackgroundColor operators to Write-Verbose #21325
supersalt97
started this conversation in
Enhancements
Replies: 2 comments
-
Rather than referring to specific colours I suggest using Consideration should also be given to abide by the NO_COLOR environment variable. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can create any string with ANSI sequences. You could also use PSStyle with the strings. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I am a long-time PowerShell user and this is my first Enhancement Request/Proposal (please be gentle).
In all my scripts, I use Write-Verbose for logging/debug. This is great, as I can switch it on/off with the $VerbosePreference variable.
I used to use Write-Host, which I like, as it has the -ForgroundColor and -BackgroundColor switches (so you can take advantage of different colours for different purposes, Red for Errors, Yellow to Information, Green for OK responses etc).
Write-Verbose is missing the -ForgroundColor and -BackgroundColor operators and I am proposing we add it as an optional switch users can use. Default can remain yellow. If users, like me want to take advantage of different colours for Verbose logging, we can.
Any thoughts, concerns or suggestions?
Obviously, I understand one of the primary reasons for Verbose Logging it to log in Transcripts/Log Files, which lack colour support, however as I run scripts hundreds of times a day, I and other users can spot "problem" Verbose output if it's in Red in the Console.
Beta Was this translation helpful? Give feedback.
All reactions