在 posh-git/powershell 提示符下更改颜色

Changing colours at posh-git/powershell prompt

我不知道如何将 -b 标志和引用的字符串更改为更具可读性的内容。

我试过更改 git 设置、posh-git 设置和 powershell 设置。 This stack answer was my last hope but I couldn't find which token-flag 我需要改变 :(

任何人都可以举例说明如何将所有 switches/flags 和带引号的字符串更改为更亮的内容吗?谢谢

来自您引用的documentation

Parameter
A parameter to a command, always begins with a dash ('-'), followed by the parameter name. Tokens with this kind are always instances of ParameterToken.
[…]
StringExpandable
A double quoted string literal. Tokens with this kind are always instances of StringExpandableToken even if there are no nested tokens to expand.
StringLiteral
A single quoted string literal. Tokens with this kind are always instances of StringLiteralToken.

所以这应该可以满足您的要求:

Set-PSReadlineOption -TokenKind Parameter -ForegroundColor Gray
Set-PSReadlineOption -TokenKind StringExpandable -ForegroundColor Cyan
Set-PSReadlineOption -TokenKind StringLiteral -ForegroundColor Cyan