PowerShell 可用的所有颜色的列表? [英] List of all colors available for PowerShell?

查看:31
本文介绍了PowerShell 可用的所有颜色的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索可以在 PowerShell 中使用的所有颜色的列表.由于我们需要提供名称而不是十六进制数字,因此很难确定颜色是否存在,至少如果您不知道如何:))

I am searching for a list of all colors I can use in PowerShell. Since we need to provide names and no hexnumbers, it's hard to figure out if a color exists or not, at least if you don't know how :))

例如 -foregroundcolor

write-host "hello world" -foregroundcolor "red"

推荐答案

控制台颜色位于名为 [System.ConsoleColor] 的枚举中.您可以使用 [Enum]

The console colors are in an enum called [System.ConsoleColor]. You can list all the values using the GetValues static method of [Enum]

[Enum]::GetValues([System.ConsoleColor])

或者只是

[Enum]::GetValues([ConsoleColor])

这篇关于PowerShell 可用的所有颜色的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆