From 7872b4a946735b7624ed28dbfe5ec31fe260fb4c Mon Sep 17 00:00:00 2001 From: Anthony Rose Date: Wed, 29 Jan 2025 11:54:45 +0000 Subject: [PATCH] Make PowerShell colours work in light and dark terminals --- .../files/Microsoft.PowerShell_profile.ps1 | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 index db257b8..d18c46a 100644 --- a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 +++ b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 @@ -131,13 +131,25 @@ if ($LightMode) { $Host.PrivateData.ProgressForegroundColor = [ConsoleColor]::DarkYellow $Host.PrivateData.ProgressBackgroundColor = [ConsoleColor]::White $PSReadLineLightColors = @{ - Command = [ConsoleColor]::DarkYellow - Default = [ConsoleColor]::Gray - Emphasis = [ConsoleColor]::Blue - Keyword = [ConsoleColor]::DarkGreen - ListPredictionSelected = [ConsoleColor]::Red - Number = [ConsoleColor]::DarkBlue - Variable = [ConsoleColor]::DarkGreen + Default = "$([char]0x1b)[0m" + Command = "$([char]0x1b)[0m" + Comment = "$([char]0x1b)[32m" + ContinuationPrompt = "$([char]0x1b)[0m" + Emphasis = "$([char]0x1b)[36m" + Error = "$([char]0x1b)[91m" + 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 }