【问题标题】:How to change powershell terminal color(s) or completely turn off the color coding如何更改 powershell 终端颜色或完全关闭颜色编码
【发布时间】:2021-03-10 19:05:19
【问题描述】:

我的眼睛很难看到 powershell 使用的彩虹色。我需要以某种方式获得一个 powershell 终端窗口,以在白色背景上显示黑色文本的所有内容(也就是错误消息、语法、输出等)。并且我需要在 Azure Cloud Shell 中发生这种情况并“坚持”(这意味着如果我退出 cloud-shell 并返回其中,终端窗口会自动正确设置)。

这可行吗?有人可以指出我的脚本或正确的命令来执行此操作吗?或者也许可以指出一些可访问性设置?

我们将不胜感激!

比尔

【问题讨论】:

    标签: powershell colors uiaccessibility


    【解决方案1】:

    首先你需要一个配置文件来编辑:

    if ($false -eq (Test-Path $profile)){New-Item $profile -type file}
    

    接下来可以用记事本打开

    & notepad $profile
    

    或vscode

    & code $profile
    

    并将以下内容保存为您的个人资料:

    $console = $host.ui.rawui
    $console.backgroundcolor = "black"
    $console.foregroundcolor = "white"
    $colors = $host.privatedata
    $colors.verbosebackgroundcolor = "Black"
    $colors.verboseforegroundcolor = "Green"
    $colors.warningbackgroundcolor = "Red"
    $colors.warningforegroundcolor = "white"
    $colors.ErrorBackgroundColor = "Yellow"
    $colors.ErrorForegroundColor = "Red"
    set-location C:\
    clear-host
    

    【讨论】:

    • 这已经接近我想要的了。但是,现在当我在提示符下键入命令时,命令需要一段时间才能出现。当它出现时,字母在黑盒子里是白色的。更好,但有点分散注意力。
    猜你喜欢
    • 1970-01-01
    • 2010-12-05
    • 2020-07-04
    • 2022-01-08
    • 2015-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多