Powershell 输出的自定义字体颜色
Custom font color for Powershell output
让我们使用 powershell 命令 Write-Host "red text" -Fore red
这会在红色前景中显示“红色文本”。
但是,您希望文本以稍微亮一点的方式显示
字体颜色,浅红色。
有没有办法做到这一点并使用 powershell 获得 RGB 光谱中的任何前景颜色(和背景)?
$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
看到这个:https://github.com/PoshCode/Pansies
它是执行此操作的 PowerShell 模块。
这里有一个与您的问题相关的问题:
https://github.com/PowerShell/PowerShell/issues/14588
请点击上面的link了解更多信息。
让我们使用 powershell 命令 Write-Host "red text" -Fore red
这会在红色前景中显示“红色文本”。
但是,您希望文本以稍微亮一点的方式显示
字体颜色,浅红色。
有没有办法做到这一点并使用 powershell 获得 RGB 光谱中的任何前景颜色(和背景)?
$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
看到这个:https://github.com/PoshCode/Pansies
它是执行此操作的 PowerShell 模块。
这里有一个与您的问题相关的问题:
https://github.com/PowerShell/PowerShell/issues/14588
请点击上面的link了解更多信息。