From 7bb19086e87665b73900b2633b87c02b77bb4a36 Mon Sep 17 00:00:00 2001 From: Anthony Rose Date: Mon, 27 Jan 2025 11:48:35 +0000 Subject: [PATCH] Add light mode colours --- .../files/Microsoft.PowerShell_profile.ps1 | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 index cd32a80..db257b8 100644 --- a/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 +++ b/roles/home-cli/files/Microsoft.PowerShell_profile.ps1 @@ -108,6 +108,40 @@ Set-PSReadLineKeyHandler -Chord Ctrl+Backspace -Function BackwardKillWord Set-PSReadLineKeyHandler -Chord Ctrl+Delete -Function KillWord Set-PSReadLineKeyHandler -Chord Shift+Spacebar -Function SelfInsert +# Set terminal to light mode. +foreach ($Property in $Host.PrivateData.PSObject.Properties.Name) { + if ($Property -match '.*ForegroundColor$') { + $Host.PrivateData.$Property = $Host.UI.RawUI.ForegroundColor + } + if ($Property -match '.*BackgroundColor$') { + $Host.PrivateData.$Property = $Host.UI.RawUI.BackgroundColor + } +} + +[bool]$LightMode = $true +if ($LightMode) { + $Host.PrivateData.ErrorForegroundColor = [ConsoleColor]::DarkRed + $Host.PrivateData.ErrorBackgroundColor = [ConsoleColor]::White + $Host.PrivateData.WarningForegroundColor = [ConsoleColor]::DarkYellow + $Host.PrivateData.WarningBackgroundColor = [ConsoleColor]::White + $Host.PrivateData.DebugForegroundColor = [ConsoleColor]::DarkYellow + $Host.PrivateData.DebugBackgroundColor = [ConsoleColor]::White + $Host.PrivateData.VerboseForegroundColor = [ConsoleColor]::DarkYellow + $Host.PrivateData.VerboseBackgroundColor = [ConsoleColor]::White + $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 + } + Set-PSReadLineOption -Colors $PSReadLineLightColors +} + # Keep this at the end. if (Test-Path "$PSScriptRoot/local.ps1") { . "$PSScriptRoot/local.ps1"