Add light mode colours

This commit is contained in:
Anthony Rose 2025-01-27 11:48:35 +00:00
parent 19b0a4e966
commit 7bb19086e8

View file

@ -108,6 +108,40 @@ Set-PSReadLineKeyHandler -Chord Ctrl+Backspace -Function BackwardKillWord
Set-PSReadLineKeyHandler -Chord Ctrl+Delete -Function KillWord Set-PSReadLineKeyHandler -Chord Ctrl+Delete -Function KillWord
Set-PSReadLineKeyHandler -Chord Shift+Spacebar -Function SelfInsert 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. # Keep this at the end.
if (Test-Path "$PSScriptRoot/local.ps1") { if (Test-Path "$PSScriptRoot/local.ps1") {
. "$PSScriptRoot/local.ps1" . "$PSScriptRoot/local.ps1"