Last active
June 20, 2023 02:49
-
-
Save naumazeredo/e0eb9b53b78d0057798a773ae741907e to your computer and use it in GitHub Desktop.
Oh-my-posh V2 kogyblack theme
This file contains hidden or 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
| # Copy to $($ThemeSettings.MyThemesLocation)\kogyblack.psm1 and change theme with Set-Theme kogyblack | |
| #requires -Version 2 -Modules posh-git | |
| function Write-Theme { | |
| param( | |
| [bool] | |
| $lastCommandFailed, | |
| [string] | |
| $with | |
| ) | |
| #check for elevated prompt | |
| If (Test-Administrator) { | |
| $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol)" -ForegroundColor $sl.Colors.AdminIconForegroundColor | |
| } | |
| if (Test-NotDefaultUser($user)) { | |
| $lambda = [char]::ConvertFromUtf32(0x000003BB) | |
| $color = $sl.Colors.PromptSymbolColor | |
| #check the last command state and indicate if failed | |
| if ($lastCommandFailed) { | |
| $color = $sl.Colors.CommandFailedIconForegroundColor | |
| } | |
| $prompt += Write-Prompt -Object "$lambda " -ForegroundColor $color | |
| } | |
| $user = $sl.CurrentUser | |
| $computer = $sl.CurrentHostname | |
| if (Test-NotDefaultUser($user)) { | |
| #$prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor | |
| $prompt += Write-Prompt -Object "$user " -ForegroundColor $sl.Colors.SessionInfoForegroundColor | |
| } | |
| # Writes the drive portion | |
| $drive = $sl.PromptSymbols.HomeSymbol | |
| if ($pwd.Path -ne $HOME) { | |
| $drive = "$($pwd.ToString().split('\')[-3..-1] -join '\')" | |
| } | |
| $prompt += Write-Prompt -Object "$drive " -ForegroundColor $sl.Colors.DriveForegroundColor | |
| $status = Get-VCSStatus | |
| if ($status) { | |
| $info = Get-VcsInfo -status ($status) | |
| $prompt += Write-Prompt -Object "$($status.branch) " -ForegroundColor $info.BackgroundColor | |
| } | |
| <# | |
| # write virtualenv | |
| if (Test-VirtualEnv) { | |
| $prompt += Write-Prompt -Object 'env:' -ForegroundColor $sl.Colors.PromptForegroundColor | |
| $prompt += Write-Prompt -Object "$(Get-VirtualEnvName) " -ForegroundColor $info.VirtualEnvForegroundColor | |
| } | |
| #> | |
| if ($with) { | |
| $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor | |
| } | |
| $prompt | |
| } | |
| $sl = $global:ThemeSettings #local settings | |
| $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) | |
| $sl.Colors.PromptForegroundColor = [ConsoleColor]::White | |
| $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green | |
| $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkRed | |
| $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed | |
| $sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed | |
| $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan | |
| $sl.Colors.SessionInfoForegroundColor = [ConsoleColor]::Blue |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy to
$($ThemeSettings.MyThemesLocation)\kogyblack.psm1and change theme withSet-Theme kogyblack