From f35bbe4c697e73bb04bc4aeb14dac2f59bff45f0 Mon Sep 17 00:00:00 2001 From: shenbo Date: Wed, 20 May 2020 17:20:59 +0800 Subject: [PATCH] Update ys.psm1 --- Themes/ys.psm1 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Themes/ys.psm1 b/Themes/ys.psm1 index e8b60188..858c6ead 100644 --- a/Themes/ys.psm1 +++ b/Themes/ys.psm1 @@ -10,10 +10,9 @@ function Write-Theme { # check the last command state and indicate if failed If ($lastCommandFailed) { $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor - $prompt += ' ' } # write # and space - $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptStartSymbolColor + $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptSymbolColor # write user and host $user = $sl.CurrentUser if (Test-NotDefaultUser($user)) { @@ -40,24 +39,26 @@ function Write-Theme { $prompt += Write-Prompt "[$timeStamp]" -ForegroundColor $foregroundColor # new line $prompt += Set-Newline - $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator + " ") -ForegroundColor $sl.Colors.PromptSymbolColor - + if (Test-Administrator) { + $prompt += Write-Prompt -Object ($sl.PromptSymbols.ElevatedSymbol + " ") -ForegroundColor $sl.Colors.AdminIconForegroundColor + } + else{ + $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator + " ") -ForegroundColor $sl.Colors.PromptSymbolColor + } } $sl = $global:ThemeSettings # local settings $sl.PromptSymbols.StartSymbol = '#' $sl.PromptSymbols.PromptIndicator = '%' -If (Test-Administrator) { - $sl.PromptSymbols.PromptIndicator = '$' - } +$sl.PromptSymbols.ElevatedSymbol = '$' $sl.GitSymbols.BranchSymbol = '' $sl.GitSymbols.BranchUntrackedSymbol = 'x' $sl.GitSymbols.BranchIdenticalStatusToSymbol = 'o' $sl.PromptSymbols.FailedCommandSymbol = '?' # for dark theme -$sl.Colors.PromptStartSymbolColor = [ConsoleColor]::Blue -$sl.Colors.PromptSymbolColor = [ConsoleColor]::Red +$sl.Colors.AdminIconForegroundColor = [ConsoleColor]::Red +$sl.Colors.PromptSymbolColor = [ConsoleColor]::Blue $sl.Colors.PromptForegroundColor = [ConsoleColor]::Green $sl.Colors.PromptHighlightColor = [ConsoleColor]::Cyan $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow