如何更改 powershell 终端颜色或完全关闭颜色编码

问题描述 投票:0回答:3

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

这可行吗?有人可以给我指出一个脚本或正确的命令来执行此操作吗?或者也许向我指出一些辅助功能设置?

我们将不胜感激!

比尔

powershell colors uiaccessibility
3个回答
0
投票

首先您需要一个要编辑的个人资料:

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

0
投票

OP要求黑白,而不是其他颜色的错误。

你在这里:

## NO colored syntax thank you.

$console = $host.ui.rawui
$console.backgroundcolor = "black"
$console.foregroundcolor = "white"
$colors = $host.privatedata
$colors.verbosebackgroundcolor = "Black"
$colors.verboseforegroundcolor = "White"
$colors.warningbackgroundcolor = "Black"
$colors.warningforegroundcolor = "White"
$colors.Errorbackgroundcolor = "Black"
$colors.Errorforegroundcolor = "White"
set-location C:\
clear-host

0
投票

另一种选择是将应用程序外观主题更改为明亮模式。然后我可以看到黑色文本和白色背景。

© www.soinside.com 2019 - 2024. All rights reserved.