【发布时间】:2021-04-15 09:17:56
【问题描述】:
让我们使用powershell命令Write-Host "red text" -Fore red
这将在红色前景中显示“红色文本”。
但是,您希望文本以稍微浅一点的方式显示
字体颜色,浅红色。
有没有办法做到这一点并使用 powershell 在 RGB 光谱中获取任何前景色(和背景)?
【问题讨论】:
标签: powershell colors output
让我们使用powershell命令Write-Host "red text" -Fore red
这将在红色前景中显示“红色文本”。
但是,您希望文本以稍微浅一点的方式显示
字体颜色,浅红色。
有没有办法做到这一点并使用 powershell 在 RGB 光谱中获取任何前景色(和背景)?
【问题讨论】:
标签: powershell colors output
看到这个:https://github.com/PoshCode/Pansies
它是执行此操作的 PowerShell 模块。
这里有一个与您的问题相关的问题:
https://github.com/PowerShell/PowerShell/issues/14588
请点击以上链接了解更多信息。
【讨论】:
$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
【讨论】:
write-host "`e[7;6;$(60)m[60]" 的事情,但这导致了一个非常奇怪的交替背景。