Add function to set dark mode
This commit is contained in:
parent
5217231f6e
commit
4e3a5fe8ac
1 changed files with 59 additions and 14 deletions
|
@ -118,6 +118,49 @@ foreach ($Property in $Host.PrivateData.PSObject.Properties.Name) {
|
|||
}
|
||||
}
|
||||
|
||||
function Set-AntDarkMode {
|
||||
if ($PSVersionTable.PSVersion.Major -le 5) {
|
||||
# $PSStyle doesn't exist in PowerShell 5.1, so import the external module.
|
||||
Import-Module -Name PSStyle
|
||||
}
|
||||
|
||||
$DefaultTheme = @{
|
||||
Command = "$([char]0x1b)[93m"
|
||||
Comment = "$([char]0x1b)[32m"
|
||||
ContinuationPrompt = "$([char]0x1b)[33m"
|
||||
Default = "$([char]0x1b)[33m"
|
||||
Emphasis = "$([char]0x1b)[96m"
|
||||
Error = "$([char]0x1b)[91m"
|
||||
InlinePrediction = "$([char]0x1b)[38;5;238m"
|
||||
Keyword = "$([char]0x1b)[92m"
|
||||
ListPrediction = "$([char]0x1b)[33m"
|
||||
ListPredictionSelected = "$([char]0x1b)[48;5;238m"
|
||||
ListPredictionTooltip = "$([char]0x1b)[38;5;238m"
|
||||
Member = "$([char]0x1b)[37m"
|
||||
Number = "$([char]0x1b)[97m"
|
||||
Operator = "$([char]0x1b)[90m"
|
||||
Parameter = "$([char]0x1b)[90m"
|
||||
Selection = "$([char]0x1b)[35;43m"
|
||||
String = "$([char]0x1b)[36m"
|
||||
Type = "$([char]0x1b)[37m"
|
||||
Variable = "$([char]0x1b)[92m"
|
||||
}
|
||||
|
||||
$PSStyle.Formatting.FormatAccent = "$([char]0x1b)[32;1m"
|
||||
$PSStyle.Formatting.TableHeader = "$([char]0x1b)[32;1m"
|
||||
$PSStyle.Formatting.ErrorAccent = "$([char]0x1b)[36;1m"
|
||||
$PSStyle.Formatting.Error = "$([char]0x1b)[31;1m"
|
||||
$PSStyle.Formatting.Warning = "$([char]0x1b)[33;1m"
|
||||
$PSStyle.Formatting.Verbose = "$([char]0x1b)[33;1m"
|
||||
$PSStyle.Formatting.Debug = "$([char]0x1b)[33;1m"
|
||||
$PSStyle.Progress.Style = "$([char]0x1b)[33;1m"
|
||||
$PSStyle.FileInfo.Directory = "$([char]0x1b)[44;1m"
|
||||
$PSStyle.FileInfo.SymbolicLink = "$([char]0x1b)[36;1m"
|
||||
$PSStyle.FileInfo.Executable = "$([char]0x1b)[32;1m"
|
||||
|
||||
Set-PSReadLineOption -Colors $DefaultTheme
|
||||
}
|
||||
|
||||
function Set-AntLightMode {
|
||||
# https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/using-light-theme
|
||||
|
||||
|
@ -146,24 +189,26 @@ function Set-AntLightMode {
|
|||
ListPredictionSelected = $PSStyle.Background.FromRGB(0x93A1A1)
|
||||
Selection = $PSStyle.Background.FromRGB(0x00BFFF)
|
||||
}
|
||||
$PSStyle.Formatting.FormatAccent = "`e[32m"
|
||||
$PSStyle.Formatting.TableHeader = "`e[32m"
|
||||
$PSStyle.Formatting.ErrorAccent = "`e[36m"
|
||||
$PSStyle.Formatting.Error = "`e[31m"
|
||||
$PSStyle.Formatting.Warning = "`e[33m"
|
||||
$PSStyle.Formatting.Verbose = "`e[33m"
|
||||
$PSStyle.Formatting.Debug = "`e[33m"
|
||||
$PSStyle.Progress.Style = "`e[33m"
|
||||
|
||||
$PSStyle.Formatting.FormatAccent = "$([char]0x1b)[32m"
|
||||
$PSStyle.Formatting.TableHeader = "$([char]0x1b)[32m"
|
||||
$PSStyle.Formatting.ErrorAccent = "$([char]0x1b)[36m"
|
||||
$PSStyle.Formatting.Error = "$([char]0x1b)[31m"
|
||||
$PSStyle.Formatting.Warning = "$([char]0x1b)[33m"
|
||||
$PSStyle.Formatting.Verbose = "$([char]0x1b)[33m"
|
||||
$PSStyle.Formatting.Debug = "$([char]0x1b)[33m"
|
||||
$PSStyle.Progress.Style = "$([char]0x1b)[33m"
|
||||
$PSStyle.FileInfo.Directory = $PSStyle.Background.FromRgb(0x2f6aff) +
|
||||
$PSStyle.Foreground.BrightWhite
|
||||
$PSStyle.FileInfo.SymbolicLink = "`e[36m"
|
||||
$PSStyle.FileInfo.Executable = "`e[95m"
|
||||
$PSStyle.FileInfo.SymbolicLink = "$([char]0x1b)[36m"
|
||||
$PSStyle.FileInfo.Executable = "$([char]0x1b)[95m"
|
||||
if ($PSVersionTable.PSVersion.Major -gt 5) {
|
||||
$PSStyle.FileInfo.Extension['.ps1'] = "`e[36m"
|
||||
$PSStyle.FileInfo.Extension['.ps1xml'] = "`e[36m"
|
||||
$PSStyle.FileInfo.Extension['.psd1'] = "`e[36m"
|
||||
$PSStyle.FileInfo.Extension['.psm1'] = "`e[36m"
|
||||
$PSStyle.FileInfo.Extension['.ps1'] = "$([char]0x1b)[36m"
|
||||
$PSStyle.FileInfo.Extension['.ps1xml'] = "$([char]0x1b)[36m"
|
||||
$PSStyle.FileInfo.Extension['.psd1'] = "$([char]0x1b)[36m"
|
||||
$PSStyle.FileInfo.Extension['.psm1'] = "$([char]0x1b)[36m"
|
||||
}
|
||||
|
||||
Set-PSReadLineOption -Colors $ISETheme
|
||||
}
|
||||
Set-AntLightMode
|
||||
|
|
Loading…
Reference in a new issue