Kudos
Kudos

Reputation: 366

Custom font color for Powershell output

Let's take the powershell command Write-Host "red text" -Fore red this displays "red text" in a foreground of red.
But, you want the text to be displayed in a slightly lighter font color, light red.

Is there a way to do this and get any foreground color (and background) in the RGB spectrum using powershell?

Upvotes: 4

Views: 1716

Answers (2)

AdamJane23
AdamJane23

Reputation: 21

See this: https://github.com/PoshCode/Pansies
It is a PowerShell module that does this. There is an issue here related to your question: https://github.com/PowerShell/PowerShell/issues/14588
Please click the above link for more information.

Upvotes: 2


$PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      1      0

(0..256).ForEach{write-host "`e[38;5;$($_)m[$_]"} # background color
(0..256).ForEach{write-host "`e[48;5;$($_)m[$_]"} # Foreground color

Upvotes: 1

Related Questions