This repository has been archived by the owner on Feb 16, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d71aa27
commit 68696d0
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#requires -Version 2 -Modules posh-git | ||
|
||
function Write-Theme { | ||
param( | ||
[bool] | ||
$lastCommandFailed, | ||
[string] | ||
$with | ||
) | ||
|
||
#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 | ||
} | ||
|
||
$lambda = [char]::ConvertFromUtf32(0x000003BB) | ||
if (Test-NotDefaultUser($lambda)) { | ||
$prompt += Write-Prompt -Object "$lambda " -ForegroundColor $sl.Colors.PromptForegroundColor | ||
} | ||
|
||
# Writes the drive portion | ||
$prompt += Write-Prompt -Object "$(Get-ShortPath -dir $pwd) " -ForegroundColor $sl.Colors.DriveForegroundColor | ||
|
||
$status = Get-VCSStatus | ||
if ($status) { | ||
$themeInfo = Get-VcsInfo -status ($status) | ||
$prompt += Write-Prompt -Object "git:" -ForegroundColor $sl.Colors.PromptForegroundColor | ||
$prompt += Write-Prompt -Object "$($themeInfo.VcInfo) " -ForegroundColor $themeInfo.BackgroundColor | ||
} | ||
|
||
# write virtualenv | ||
if (Test-VirtualEnv) { | ||
$prompt += Write-Prompt -Object 'env:' -ForegroundColor $sl.Colors.PromptForegroundColor | ||
$prompt += Write-Prompt -Object "$(Get-VirtualEnvName) " -ForegroundColor $themeInfo.VirtualEnvForegroundColor | ||
} | ||
|
||
if ($with) { | ||
$prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor | ||
} | ||
|
||
} | ||
|
||
$sl = $global:ThemeSettings #local settings | ||
$sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) | ||
$sl.Colors.PromptForegroundColor = [ConsoleColor]::White | ||
$sl.Colors.PromptSymbolColor = [ConsoleColor]::White | ||
$sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkRed | ||
$sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed | ||
$sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed | ||
$sl.Colors.DriveForegroundColor = [ConsoleColor]::DarkRed |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.