#requires -Version 2 -Modules posh-git function Write-Theme { param( [bool] $lastCommandFailed, [string] $with ) $prompt = Write-Prompt -Object "$($sl.PromptSymbols.StartSymbol) " -ForegroundColor $sl.Colors.PromptForegroundColor If (!$env:_ -contains 'pwsh') { $prompt += ' ' } #check the last command state and indicate if failed If ($lastCommandFailed) { $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor } #check for elevated prompt If (Test-Administrator) { $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor } $computer = [System.Environment]::MachineName $path = Get-FullPath -dir $pwd $prompt += Write-Prompt -Object "$computer" -ForegroundColor $sl.Colors.SessionInfoForegroundColor $prompt += Write-Prompt -Object ": " -ForegroundColor $sl.Colors.SessionInfoForegroundColor # Writes the drive portion $prompt += Write-Prompt -Object "$path " $status = Get-VCSStatus if ($status) { $themeInfo = Get-VcsInfo -status ($status) $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -ForegroundColor $sl.Colors.GitForegroundColor } $prompt += Set-Newline 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.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) $sl.Colors.PromptForegroundColor = [ConsoleColor]::White $sl.Colors.PromptSymbolColor = [ConsoleColor]::White $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue $sl.Colors.GitForegroundColor = [ConsoleColor]::DarkBlue $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White