Make PowerShell colours work in light and dark terminals

This commit is contained in:
Anthony Rose 2025-01-29 11:54:45 +00:00
parent 985663d810
commit 7872b4a946

View file

@ -131,13 +131,25 @@ if ($LightMode) {
$Host.PrivateData.ProgressForegroundColor = [ConsoleColor]::DarkYellow $Host.PrivateData.ProgressForegroundColor = [ConsoleColor]::DarkYellow
$Host.PrivateData.ProgressBackgroundColor = [ConsoleColor]::White $Host.PrivateData.ProgressBackgroundColor = [ConsoleColor]::White
$PSReadLineLightColors = @{ $PSReadLineLightColors = @{
Command = [ConsoleColor]::DarkYellow Default = "$([char]0x1b)[0m"
Default = [ConsoleColor]::Gray Command = "$([char]0x1b)[0m"
Emphasis = [ConsoleColor]::Blue Comment = "$([char]0x1b)[32m"
Keyword = [ConsoleColor]::DarkGreen ContinuationPrompt = "$([char]0x1b)[0m"
ListPredictionSelected = [ConsoleColor]::Red Emphasis = "$([char]0x1b)[36m"
Number = [ConsoleColor]::DarkBlue Error = "$([char]0x1b)[91m"
Variable = [ConsoleColor]::DarkGreen InlinePrediction = "$([char]0x1b)[47;90m"
Keyword = "$([char]0x1b)[32m"
ListPrediction = "$([char]0x1b)[47;90m"
ListPredictionSelected = "$([char]0x1b)[100;97m"
ListPredictionTooltip = "$([char]0x1b)[45;33m"
Member = "$([char]0x1b)[0m"
Number = "$([char]0x1b)[31m"
Operator = "$([char]0x1b)[90m"
Parameter = "$([char]0x1b)[90m"
Selection = "$([char]0x1b)[7m"
String = "$([char]0x1b)[36m"
Type = "$([char]0x1b)[0m"
Variable = "$([char]0x1b)[32m"
} }
Set-PSReadLineOption -Colors $PSReadLineLightColors Set-PSReadLineOption -Colors $PSReadLineLightColors
} }