Last active
September 15, 2018 22:02
-
-
Save hasparus/9dcbcb2ffa912c3494c422163bfd1f7c to your computer and use it in GitHub Desktop.
AvitEmojiStatus -- my powershell theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# thank you Aaron -- https://www.aaron-powell.com/posts/2018-01-30-the-happy-powershell-prompt/ | |
# and you, Jan -- https://github.com/JanDeDobbeleer/oh-my-posh/blame/master/Themes/Avit.psm1 | |
#requires -Version 2 -Modules posh-git | |
$happyPrompts = @('π»'; 'π€'; 'π'; 'β€οΈ'; 'π·'; 'πΈ'; 'πΊ'; 'π'; 'π€'; 'π'; 'π€'; 'π'; 'π'; 'πΏ'; 'π―'; 'π'; 'π';) | |
$angryPrompts = @('πΏ'; 'πΉ'; 'π'; 'π€’'; 'π'; 'πΊ'; 'π΅οΈ'; 'π€·β'; 'π'; 'π₯'; 'π‘οΈ'; 'πͺ';) | |
function Write-Random { | |
param([string[]] $arr) | |
Write-Prompt -Object " $($arr[(Get-Random -min 0 -max ($arr.Length))]) " -ForegroundColor $sl.Colors.PromptForegroundColor | |
} | |
function Write-Theme { | |
param([bool] $lastCommandFailed, [string] $with) | |
$prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptForegroundColor | |
$dir = Get-FullPath -dir $pwd | |
$prompt += Write-Prompt -Object $dir -ForegroundColor $sl.Colors.PromptForegroundColor | |
$status = Get-VCSStatus | |
if ($status) { | |
$vcsInfo = Get-VcsInfo -status ($status) | |
$info = $vcsInfo.VcInfo | |
$prompt += Write-Prompt -Object " $info" -ForegroundColor $vcsInfo.BackgroundColor | |
} | |
#check for elevated prompt | |
If (Test-Administrator) { | |
$prompt += Write-Prompt -Object " $($sl.PromptSymbols.ElevatedSymbol)" -ForegroundColor $sl.Colors.AdminIconForegroundColor | |
} | |
#check the last command state and indicate if failed | |
If ($lastCommandFailed) { | |
$prompt += Write-Random $angryPrompts | |
} Else { | |
$prompt += Write-Random $happyPrompts | |
} | |
$prompt += Set-Newline | |
if (Test-VirtualEnv) { | |
$prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor -ForegroundColor $sl.Colors.VirtualEnvForegroundColor | |
} | |
if ($with) { | |
$prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor | |
} | |
# $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.PromptBackgroundColor | |
$prompt += "> " | |
$prompt | |
} | |
$sl = $global:ThemeSettings #local settings | |
$sl.PromptSymbols.StartSymbol = '' | |
$sl.Colors.PromptForegroundColor = [ConsoleColor]::DarkBlue | |
$sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed | |
$sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue | |
$sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta | |
$sl.Colors.PromptSymbolColor = [ConsoleColor]::White | |
$sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Magenta | |
$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::Red |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment