├── .github └── FUNDING.yml ├── .gitignore ├── .vscode └── settings.json ├── Build ├── release.ps1 ├── setup_test_env.ps1 └── test_windows.ps1 ├── Helpers ├── PoshGit.Tests.ps1 ├── PoshGit.ps1 ├── Prompt.Tests.ps1 └── Prompt.ps1 ├── LICENSE ├── README.md ├── Themes ├── Agnoster.psm1 ├── AgnosterPlus.psm1 ├── Avit.psm1 ├── Darkblood.psm1 ├── Emodipt.psm1 ├── Fish.psm1 ├── Honukai.psm1 ├── Lambda.psm1 ├── Material.psm1 ├── Operator.psm1 ├── Paradox.psm1 ├── Pararussel.psm1 ├── PowerLine.psm1 ├── Powerlevel10k-Classic.psm1 ├── Powerlevel10k-Lean.psm1 ├── Powerlevel9k.psm1 ├── PowerlinePlus.psm1 ├── Punk.psm1 ├── Sorin.psm1 ├── Star.psm1 ├── Zash.psm1 ├── cypher.psm1 ├── pure.psm1 ├── qwerty.psm1 ├── robbyrussell.psm1 ├── tehrob.psm1 └── ys.psm1 ├── appveyor.yml ├── defaults.ps1 ├── img ├── agnoster.png ├── avit.png ├── darkblood.png ├── emodipt.png ├── fish.png ├── honukai.png ├── indications.png ├── lambda.png ├── material.png ├── material2.png ├── operator.png ├── paradox.png ├── pararussel.png ├── robbyrussel.png ├── showcolors.png ├── sorin.png ├── star.png ├── themecolors.png ├── themesettings.png └── zash.png ├── oh-my-posh.psd1 └── oh-my-posh.psm1 /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | patreon: jandedobbeleer 4 | liberapay: jandedobbeleer 5 | custom: https://ko-fi.com/jandedobbeleer 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | TestsResults.xml -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | } -------------------------------------------------------------------------------- /Build/release.ps1: -------------------------------------------------------------------------------- 1 | if ($ENV:APPVEYOR_REPO_BRANCH -eq 'master' -and [string]::IsNullOrWhiteSpace($ENV:APPVEYOR_PULL_REQUEST_NUMBER)) { 2 | Publish-Module -path . -NuGetApiKey $env:NG_KEY -Verbose -Force 3 | #Create GitHub release 4 | Write-Host 'Starting GitHub release' 5 | $releaseData = @{ 6 | tag_name = $ENV:APPVEYOR_BUILD_VERSION 7 | target_commitish = 'master' 8 | name = $ENV:APPVEYOR_BUILD_VERSION 9 | draft = $false 10 | prerelease = $false 11 | } 12 | $auth = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($env:GH_KEY + ':x-oauth-basic')) 13 | $releaseParams = @{ 14 | Uri = 'https://api.github.com/repos/jandedobbeleer/oh-my-posh2/releases' 15 | Method = 'POST' 16 | Headers = @{ 17 | Authorization = $auth 18 | } 19 | ContentType = 'application/json' 20 | Body = (ConvertTo-Json -InputObject $releaseData -Compress) 21 | } 22 | $result = Invoke-RestMethod @releaseParams 23 | $uploadUri = $result | Select-Object -ExpandProperty upload_url 24 | $uploadUri = $uploadUri -creplace '\{\?name,label\}' #, '?name=oh-my-posh.zip' 25 | $uploadUri = $uploadUri + '?name=oh-my-posh.zip' 26 | $distFolder = Join-Path $env:APPVEYOR_BUILD_FOLDER dist 27 | mkdir $distFolder | Out-Null 28 | $excludedFiles = @(".*", "Build", "appveyor.yml", "TestsResults.xml", "dist") 29 | $distFiles = Get-ChildItem $env:APPVEYOR_BUILD_FOLDER -Exclude $excludedFiles 30 | $distFiles | Copy-Item -Destination $distFolder -Recurse 31 | Add-Type -assembly "system.io.compression.filesystem" 32 | [io.compression.zipfile]::CreateFromDirectory($distFolder, "$HOME\Desktop\oh-my-posh.zip") 33 | $uploadParams = @{ 34 | Uri = $uploadUri 35 | Method = 'POST' 36 | Headers = @{ 37 | Authorization = $auth 38 | } 39 | ContentType = 'application/zip' 40 | InFile = "$HOME\Desktop\oh-my-posh.zip" 41 | } 42 | $result = Invoke-RestMethod @uploadParams 43 | Write-Host 'GitHub release completed' 44 | } 45 | -------------------------------------------------------------------------------- /Build/setup_test_env.ps1: -------------------------------------------------------------------------------- 1 | Install-Module -Name Pester -Repository PSGallery -Force -Scope CurrentUser 2 | -------------------------------------------------------------------------------- /Build/test_windows.ps1: -------------------------------------------------------------------------------- 1 | Install-Module Coveralls -MinimumVersion 1.0.25 -Scope CurrentUser -Force -ErrorAction Stop 2 | Import-Module Coveralls -Force -ErrorAction Stop 3 | $coverageSet = @('Helpers\PoshGit.ps1','Helpers\Prompt.ps1') 4 | $res = Invoke-Pester -CodeCoverage $coverageSet -OutputFormat NUnitXml -OutputFile TestsResults.xml -PassThru -EnableExit 5 | (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestsResults.xml)) 6 | if (!$ENV:CA_KEY) { 7 | $ENV:CA_KEY = "14mb4l0n1" 8 | } 9 | $coverageResult = Format-Coverage -PesterResults $res -CoverallsApiToken $ENV:CA_KEY -BranchName $ENV:APPVEYOR_REPO_BRANCH 10 | Publish-Coverage -Coverage $coverageResult 11 | -------------------------------------------------------------------------------- /Helpers/PoshGit.Tests.ps1: -------------------------------------------------------------------------------- 1 | $global:ThemeSettings = New-Object -TypeName PSObject -Property @{ 2 | GitSymbols = @{ 3 | BranchSymbol = 'branch' 4 | OriginSymbols = @{ 5 | Github = [char]::ConvertFromUtf32(0xF09B) 6 | Bitbucket = [char]::ConvertFromUtf32(0xF171) 7 | GitLab = [char]::ConvertFromUtf32(0xF296) 8 | } 9 | } 10 | Options = @{ 11 | OriginSymbols = $false 12 | } 13 | } 14 | 15 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path 16 | $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") 17 | . "$here\$sut" 18 | 19 | 20 | Describe "Test-GetBranchSymbol" { 21 | Context "Is disabled" { 22 | BeforeAll { 23 | $global:ThemeSettings.Options.OriginSymbols = $false 24 | } 25 | It "Has Enabled set to False" { 26 | Mock Get-GitRemoteUrl { return 'github.com/test.git' } 27 | $symbol = Get-BranchSymbol 'origin/master' 28 | $symbol | Should Be $themeSettings.GitSymbols.BranchSymbol 29 | } 30 | It "Has has no upstream" { 31 | $symbol = Get-BranchSymbol 32 | $symbol | Should Be $themeSettings.GitSymbols.BranchSymbol 33 | } 34 | } 35 | Context "Is enabled" { 36 | BeforeAll { 37 | $global:ThemeSettings.Options.OriginSymbols = $true 38 | } 39 | It "Uses GitHub" { 40 | Mock Get-GitRemoteUrl { return 'github.com/test.git' } 41 | $symbol = Get-BranchSymbol 'origin/master' 42 | $symbol | Should Be $themeSettings.GitSymbols.OriginSymbols.Github 43 | } 44 | It "Uses GitLab" { 45 | Mock Get-GitRemoteUrl { return 'gitlab.com/test.git' } 46 | $symbol = Get-BranchSymbol 'origin/master' 47 | $symbol | Should Be $themeSettings.GitSymbols.OriginSymbols.GitLab 48 | } 49 | It "Uses BitBucket" { 50 | Mock Get-GitRemoteUrl { return 'bitbucket.com/test.git' } 51 | $symbol = Get-BranchSymbol 'origin/master' 52 | $symbol | Should Be $themeSettings.GitSymbols.OriginSymbols.Bitbucket 53 | } 54 | It "Uses something else" { 55 | Mock Get-GitRemoteUrl { return 'example.com/test.git' } 56 | $symbol = Get-BranchSymbol 'origin/master' 57 | $symbol | Should Be $themeSettings.GitSymbols.BranchSymbol 58 | } 59 | It "Has no remote" { 60 | $symbol = Get-BranchSymbol 61 | $symbol | Should Be $themeSettings.GitSymbols.BranchSymbol 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Helpers/PoshGit.ps1: -------------------------------------------------------------------------------- 1 | function Format-BranchName { 2 | param( 3 | [string] 4 | $branchName 5 | ) 6 | 7 | if($spg.BranchNameLimit -gt 0 -and $branchName.Length -gt $spg.BranchNameLimit) { 8 | $branchName = ' {0}{1} ' -f $branchName.Substring(0, $spg.BranchNameLimit), $spg.TruncatedBranchSuffix 9 | } 10 | return " $branchName " 11 | } 12 | 13 | function Get-VCSStatus { 14 | if (Get-Command Get-GitStatus -errorAction SilentlyContinue) { 15 | $global:GitStatus = Get-GitStatus 16 | return $global:GitStatus 17 | } 18 | return $null 19 | } 20 | 21 | function Get-BranchSymbol($upstream) { 22 | # Add remote icon instead of branchsymbol if Enabled 23 | if (-not ($upstream) -or !$sl.Options.OriginSymbols) { 24 | return $sl.GitSymbols.BranchSymbol 25 | } 26 | $originUrl = Get-GitRemoteUrl $upstream 27 | if ($originUrl.Contains("github")) { 28 | return $sl.GitSymbols.OriginSymbols.Github 29 | } 30 | elseif ($originUrl.Contains("bitbucket")) { 31 | return $sl.GitSymbols.OriginSymbols.Bitbucket 32 | } 33 | elseif ($originUrl.Contains("gitlab")) { 34 | return $sl.GitSymbols.OriginSymbols.GitLab 35 | } 36 | return $sl.GitSymbols.BranchSymbol 37 | } 38 | 39 | function Get-GitRemoteUrl($upstream) { 40 | $origin = $upstream -replace "/.*" 41 | $originUrl = git remote get-url $origin 42 | return $originUrl 43 | } 44 | 45 | 46 | function Get-VcsInfo { 47 | param( 48 | [Object] 49 | $status, 50 | [Parameter(Mandatory=$false)][Int] $branchNameMaxLength 51 | ) 52 | 53 | if ($status) { 54 | $branchStatusBackgroundColor = $sl.Colors.GitDefaultColor 55 | 56 | # Determine Colors 57 | $localChanges = ($status.HasIndex -or $status.HasUntracked -or $status.HasWorking) 58 | #Git flags 59 | $localChanges = $localChanges -or (($status.Untracked -gt 0) -or ($status.Added -gt 0) -or ($status.Modified -gt 0) -or ($status.Deleted -gt 0) -or ($status.Renamed -gt 0)) 60 | #hg/svn flags 61 | 62 | # There are local changes 63 | if($localChanges) { 64 | $branchStatusBackgroundColor = $sl.Colors.GitLocalChangesColor 65 | } 66 | # There are no local changes and the current branch is both ahead and behind 67 | elseif(($status.AheadBy -gt 0) -and ($status.BehindBy -gt 0)) { 68 | $branchStatusBackgroundColor = $sl.Colors.GitNoLocalChangesAndAheadAndBehindColor 69 | } 70 | # There are no local changes and the current branch is ahead only 71 | elseif ($status.AheadBy -gt 0) { 72 | $branchStatusBackgroundColor = $sl.Colors.GitNoLocalChangesAndAheadColor 73 | } 74 | # There are no local changes and the current branch is behind only 75 | elseif($status.BehindBy -gt 0) { 76 | $branchStatusBackgroundColor = $sl.Colors.GitNoLocalChangesAndBehindColor 77 | } 78 | 79 | $vcInfo = Get-BranchSymbol $status.Upstream 80 | $branchStatusSymbol = $null 81 | 82 | if (!$status.Upstream) { 83 | $branchStatusSymbol = $sl.GitSymbols.BranchUntrackedSymbol 84 | } 85 | elseif ($status.BehindBy -eq 0 -and $status.AheadBy -eq 0) { 86 | # We are aligned with remote 87 | $branchStatusSymbol = $sl.GitSymbols.BranchIdenticalStatusToSymbol 88 | } 89 | elseif ($status.BehindBy -ge 1 -and $status.AheadBy -ge 1) { 90 | # We are both behind and ahead of remote 91 | $branchStatusSymbol = "$($sl.GitSymbols.BranchAheadStatusSymbol)$($status.AheadBy) $($sl.GitSymbols.BranchBehindStatusSymbol)$($status.BehindBy)" 92 | } 93 | elseif ($status.BehindBy -ge 1) { 94 | # We are behind remote 95 | $branchStatusSymbol = "$($sl.GitSymbols.BranchBehindStatusSymbol)$($status.BehindBy)" 96 | } 97 | elseif ($status.AheadBy -ge 1) { 98 | # We are ahead of remote 99 | $branchStatusSymbol = "$($sl.GitSymbols.BranchAheadStatusSymbol)$($status.AheadBy)" 100 | } 101 | else 102 | { 103 | # This condition should not be possible but defaulting the variables to be safe 104 | $branchStatusSymbol = '?' 105 | } 106 | 107 | $branchName = $status.Branch 108 | if ($branchNameMaxLength -and $branchName.Length -gt $branchNameMaxLength) { 109 | $branchName = $branchName.Substring(0, $branchNameMaxLength); 110 | } 111 | 112 | $vcInfo = $vcInfo + (Format-BranchName -branchName $branchName) 113 | 114 | if ($branchStatusSymbol) { 115 | $vcInfo = $vcInfo + ('{0} ' -f $branchStatusSymbol) 116 | } 117 | 118 | if($spg.EnableFileStatus -and $status.HasIndex) { 119 | $vcInfo = $vcInfo + $sl.GitSymbols.BeforeIndexSymbol 120 | 121 | if($spg.ShowStatusWhenZero -or $status.Index.Added) { 122 | $vcInfo = $vcInfo + "$($spg.FileAddedText)$($status.Index.Added.Count) " 123 | } 124 | if($spg.ShowStatusWhenZero -or $status.Index.Modified) { 125 | $vcInfo = $vcInfo + "$($spg.FileModifiedText)$($status.Index.Modified.Count) " 126 | } 127 | if($spg.ShowStatusWhenZero -or $status.Index.Deleted) { 128 | $vcInfo = $vcInfo + "$($spg.FileRemovedText)$($status.Index.Deleted.Count) " 129 | } 130 | 131 | if ($status.Index.Unmerged) { 132 | $vcInfo = $vcInfo + "$($spg.FileConflictedText)$($status.Index.Unmerged.Count) " 133 | } 134 | 135 | if($status.HasWorking) { 136 | $vcInfo = $vcInfo + "$($sl.GitSymbols.DelimSymbol) " 137 | } 138 | } 139 | 140 | if($spg.EnableFileStatus -and $status.HasWorking) { 141 | if (!$status.HasIndex) { 142 | $vcInfo = $vcInfo + $sl.GitSymbols.BeforeWorkingSymbol 143 | } 144 | if($spg.showStatusWhenZero -or $status.Working.Added) { 145 | $vcInfo = $vcInfo + "$($spg.FileAddedText)$($status.Working.Added.Count) " 146 | } 147 | if($spg.ShowStatusWhenZero -or $status.Working.Modified) { 148 | $vcInfo = $vcInfo + "$($spg.FileModifiedText)$($status.Working.Modified.Count) " 149 | } 150 | if($spg.ShowStatusWhenZero -or $status.Working.Deleted) { 151 | $vcInfo = $vcInfo + "$($spg.FileRemovedText)$($status.Working.Deleted.Count) " 152 | } 153 | if ($status.Working.Unmerged) { 154 | $vcInfo = $vcInfo + "$($spg.FileConflictedText)$($status.Working.Unmerged.Count) " 155 | } 156 | } 157 | 158 | if ($status.HasWorking) { 159 | # We have un-staged files in the working tree 160 | $localStatusSymbol = $sl.GitSymbols.LocalWorkingStatusSymbol 161 | } 162 | elseif ($status.HasIndex) { 163 | # We have staged but uncommited files 164 | $localStatusSymbol = $sl.GitSymbols.LocalStagedStatusSymbol 165 | } 166 | else { 167 | # No uncommited changes 168 | $localStatusSymbol = $sl.GitSymbols.LocalDefaultStatusSymbol 169 | } 170 | 171 | if ($localStatusSymbol) { 172 | $vcInfo = $vcInfo + ('{0} ' -f $localStatusSymbol) 173 | } 174 | 175 | if ($status.StashCount -gt 0) { 176 | $vcInfo = $vcInfo + "$($sl.GitSymbols.BeforeStashSymbol)$($status.StashCount)$($sl.GitSymbols.AfterStashSymbol) " 177 | } 178 | 179 | return New-Object PSObject -Property @{ 180 | BackgroundColor = $branchStatusBackgroundColor 181 | VcInfo = $vcInfo.Trim() 182 | } 183 | } 184 | } 185 | 186 | $spg = $global:GitPromptSettings #Posh-Git settings 187 | $sl = $global:ThemeSettings #local settings 188 | -------------------------------------------------------------------------------- /Helpers/Prompt.Tests.ps1: -------------------------------------------------------------------------------- 1 | $global:ThemeSettings = New-Object -TypeName PSObject -Property @{ 2 | CurrentThemeLocation = "$PSScriptRoot\Themes\Agnoster.psm1" 3 | MyThemesLocation = '~\Documents\WindowsPowerShell\PoshThemes' 4 | ErrorCount = 0 5 | PromptSymbols = @{ 6 | StartSymbol = ' ' 7 | TruncatedFolderSymbol = '..' 8 | PromptIndicator = '>' 9 | FailedCommandSymbol = 'x' 10 | ElevatedSymbol = '!' 11 | SegmentForwardSymbol = '>' 12 | SegmentBackwardSymbol = '<' 13 | SegmentSeparatorForwardSymbol = '>' 14 | SegmentSeparatorBackwardSymbol = '<' 15 | PathSeparator = '\' 16 | HomeSymbol = '*' 17 | RootSymbol = '#' 18 | UNCSymbol = '§' 19 | } 20 | } 21 | 22 | $here = Split-Path -Parent $MyInvocation.MyCommand.Path 23 | $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") 24 | . "$here\$sut" 25 | 26 | function New-MockPath { 27 | param ( 28 | [Parameter(Mandatory = $true)] 29 | [System.String] 30 | $Location, 31 | [Parameter(Mandatory = $true)] 32 | [System.String] 33 | $ProviderName, 34 | [Parameter(Mandatory = $false)] 35 | [System.String] 36 | $DriveName 37 | ) 38 | 39 | $provider = New-MockObject -Type System.Management.Automation.ProviderInfo 40 | $path = New-MockObject -Type System.Management.Automation.PathInfo 41 | $provider | Add-Member -Type NoteProperty -Name 'Name' -Value $ProviderName -Force 42 | $path | Add-Member -Type NoteProperty -Name 'Path' -Value $Location -Force 43 | $path | Add-Member -Type NoteProperty -Name 'Provider' -Value $provider -Force 44 | if ($null -ne $DriveName) { 45 | $driveInfo = New-MockObject -Type System.Management.Automation.PSDriveInfo 46 | $driveInfo | Add-Member -Type NoteProperty -Name 'Name' -Value $DriveName -Force 47 | $path | Add-Member -Type NoteProperty -Name 'Drive' -Value $driveInfo -Force 48 | } 49 | return $path 50 | } 51 | 52 | Describe "Test-IsVanillaWindow" { 53 | BeforeEach { Remove-Item Env:\ConEmuANSI -ErrorAction SilentlyContinue 54 | Remove-Item Env:\PROMPT -ErrorAction SilentlyContinue 55 | Remove-Item Env:\TERM_PROGRAM -ErrorAction SilentlyContinue } 56 | Context "Running in a non-vanilla window" { 57 | It "runs in ConEmu and outputs 'false'" { 58 | $env:ConEmuANSI = "ON" 59 | Mock Test-AnsiTerminal { return $false } 60 | Test-IsVanillaWindow | Should Be $false 61 | } 62 | It "runs in ConEmu and outputs 'false'" { 63 | $env:ConEmuANSI = "ON" 64 | Mock Test-AnsiTerminal { return $true } 65 | Test-IsVanillaWindow | Should Be $false 66 | } 67 | It "runs in an ANSI supported terminal and outputs 'false'" { 68 | $env:ConEmuANSI = $false 69 | Mock Test-AnsiTerminal { return $true } 70 | Test-IsVanillaWindow | Should Be $false 71 | } 72 | It "runs in ConEmu and outputs 'false'" { 73 | $env:ConEmuANSI = $true 74 | Test-IsVanillaWindow | Should Be $false 75 | } 76 | It "runs in cmder and outputs 'false'" { 77 | $env:PROMPT = $true 78 | Mock Test-AnsiTerminal { return $false } 79 | Test-IsVanillaWindow | Should Be $false 80 | } 81 | It "runs in cmder and conemu and outputs 'false'" { 82 | $env:PROMPT = $true 83 | $env:ConEmuANSI = $true 84 | Mock Test-AnsiTerminal { return $false } 85 | Test-IsVanillaWindow | Should Be $false 86 | } 87 | It "runs in Hyper.js and outputs 'false'" { 88 | $env:TERM_PROGRAM = "Hyper" 89 | Mock Test-AnsiTerminal { return $false } 90 | Test-IsVanillaWindow | Should Be $false 91 | } 92 | It "runs in vscode and outputs 'false'" { 93 | $env:TERM_PROGRAM = "vscode" 94 | Mock Test-AnsiTerminal { return $false } 95 | Test-IsVanillaWindow | Should Be $false 96 | } 97 | } 98 | Context "Running in a vanilla window" { 99 | It "runs in a vanilla window and outputs 'true'" { 100 | Mock Test-AnsiTerminal { return $false } 101 | Test-IsVanillaWindow | Should Be $true 102 | } 103 | } 104 | } 105 | 106 | Describe "Get-Home" { 107 | It "returns $($HOME.TrimEnd('/','\'))" { 108 | Get-Home | Should Be $HOME.TrimEnd('/', '\') 109 | } 110 | } 111 | 112 | Describe "Get-Provider" { 113 | It "uses the provider 'AwesomeSauce'" { 114 | $expected = 'AwesomeSauce' 115 | $path = New-MockPath -Location 'C:\Users\Jan\Test' -ProviderName $expected 116 | Get-Provider $path | Should Be $expected 117 | } 118 | } 119 | 120 | Describe "Get-FormattedRootLocation" { 121 | Context "Running in the FileSystem" { 122 | BeforeAll { 123 | Mock Get-Home { return 'C:\Users\Jan' } 124 | Mock Test-Windows { return $true } 125 | } 126 | It "is in the $HOME folder" { 127 | $path = New-MockPath -Location 'C:\Users\Jan' -ProviderName 'FileSystem' -DriveName 'C' 128 | Get-FormattedRootLocation $path | Should Be $ThemeSettings.PromptSymbols.HomeSymbol 129 | } 130 | It "is somewhere in the $HOME folder" { 131 | $path = New-MockPath -Location 'C:\Users\Jan\Git\Somewhere' -ProviderName 'FileSystem' -DriveName 'C' 132 | Get-FormattedRootLocation $path | Should Be $ThemeSettings.PromptSymbols.HomeSymbol 133 | } 134 | It "is in 'Microsoft.PowerShell.Core\FileSystem::\\Test\Hello' with Drive X:" { 135 | $path = New-MockPath -Location 'Microsoft.PowerShell.Core\FileSystem::\\Test\Hello' -ProviderName 'FileSystem' -DriveName 'X' 136 | Get-FormattedRootLocation $path | Should Be $ThemeSettings.PromptSymbols.UNCSymbol 137 | } 138 | It "is in C:" { 139 | $path = New-MockPath -Location 'C:\Documents' -ProviderName 'FileSystem' -DriveName 'C' 140 | Get-FormattedRootLocation $path | Should Be '' 141 | } 142 | It "is has no drive" { 143 | $path = New-MockPath -Location 'J:\Test\Folder\Somewhere' -ProviderName 'FileSystem' -DriveName 'J' 144 | Get-FormattedRootLocation $path | Should Be '' 145 | } 146 | It "is has no valid path" { 147 | if (Test-PsCore) { 148 | $true | Should Be $true 149 | } 150 | else { 151 | $path = New-MockPath -Location 'J\Test\Folder\Somewhere' -ProviderName 'FileSystem' -DriveName 'J' 152 | Get-FormattedRootLocation $path | Should Be 'J:' 153 | } 154 | } 155 | } 156 | Context "Running outside of the FileSystem" { 157 | It "running outside of the Filesystem in L:" { 158 | $path = New-MockPath -Location 'L:\Documents\Somewhere' -ProviderName 'SomewhereElse' -DriveName 'L' 159 | Get-FormattedRootLocation $path | Should Be 'L' 160 | } 161 | } 162 | } 163 | 164 | Describe "Get-FullPath" { 165 | Context "Running in the FileSystem" { 166 | BeforeAll { Mock Get-Home { return 'C:\Users\Jan' } } 167 | It "is in the $HOME folder" { 168 | $path = New-MockPath -Location 'C:\Users\Jan' -ProviderName 'FileSystem' -DriveName 'C' 169 | Get-FullPath $path | Should Be $ThemeSettings.PromptSymbols.HomeSymbol 170 | } 171 | It "is somewhere in the $HOME folder" { 172 | $path = New-MockPath -Location 'C:\Users\Jan\Git\Somewhere' -ProviderName 'FileSystem' -DriveName 'C' 173 | Get-FullPath $path | Should Be "$($ThemeSettings.PromptSymbols.HomeSymbol)\Git\Somewhere" 174 | } 175 | } 176 | } 177 | 178 | Describe "Get-ShortPath" { 179 | if (Test-Windows) { 180 | Context "Running in the FileSystem on Windows" { 181 | BeforeAll { 182 | Mock Get-Home { return 'C:\Users\Jan' } 183 | Mock Get-OSPathSeparator { return '\' } 184 | } 185 | It "is in a root folder" { 186 | $path = New-MockPath -Location 'C:\Users\' -ProviderName 'FileSystem' -DriveName 'C' 187 | Get-ShortPath $path | Should Be "C:$($ThemeSettings.PromptSymbols.PathSeparator)Users" 188 | } 189 | It "is outside the $HOME folder" { 190 | $path = New-MockPath -Location 'C:\Tools\Something' -ProviderName 'FileSystem' -DriveName 'C' 191 | Get-ShortPath $path | Should Be "C:$($ThemeSettings.PromptSymbols.PathSeparator)$($ThemeSettings.PromptSymbols.TruncatedFolderSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)Something" 192 | } 193 | It "is in the $HOME folder" { 194 | $path = New-MockPath -Location 'C:\Users\Jan\' -ProviderName 'FileSystem' -DriveName 'C' 195 | Get-ShortPath $path | Should Be $ThemeSettings.PromptSymbols.HomeSymbol 196 | } 197 | It "is somewhere in the $HOME folder" { 198 | $path = New-MockPath -Location 'C:\Users\Jan\Git\Somewhere' -ProviderName 'FileSystem' -DriveName 'C' 199 | Get-ShortPath $path | Should Be "$($ThemeSettings.PromptSymbols.HomeSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)$($ThemeSettings.PromptSymbols.TruncatedFolderSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)Somewhere" 200 | } 201 | It "is in 'Microsoft.PowerShell.Core\FileSystem::\\Test\Hello'" { 202 | $path = New-MockPath -Location 'Microsoft.PowerShell.Core\FileSystem::\\Test\Hello' -ProviderName 'FileSystem' -DriveName 'Microsoft.PowerShell.Core' 203 | Get-ShortPath $path | Should Be "$($ThemeSettings.PromptSymbols.UNCSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)$($ThemeSettings.PromptSymbols.TruncatedFolderSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)Hello" 204 | } 205 | } 206 | } 207 | if (-Not (Test-Windows)) { 208 | Context "Running on the filesystem in UNIX" { 209 | BeforeAll { 210 | Mock Get-Home { return '/Users/Jan' } 211 | Mock Get-OSPathSeparator { return '/' } 212 | } 213 | It "is outside the $HOME folder" { 214 | $path = New-MockPath -Location 'C:/Tools/Something' -ProviderName 'FileSystem' -DriveName 'C' 215 | Get-ShortPath $path | Should Be "C:$($ThemeSettings.PromptSymbols.PathSeparator)$($ThemeSettings.PromptSymbols.TruncatedFolderSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)Something" 216 | } 217 | It "is in a root folder" { 218 | $path = New-MockPath -Location '/Users/' -ProviderName 'FileSystem' -DriveName '/' 219 | Get-ShortPath $path | Should Be 'Users' 220 | } 221 | It "is in the $HOME folder" { 222 | $path = New-MockPath -Location '/Users/Jan/' -ProviderName 'FileSystem' -DriveName '/' 223 | Get-ShortPath $path | Should Be $ThemeSettings.PromptSymbols.HomeSymbol 224 | } 225 | It "is somewhere in the $HOME folder" { 226 | $path = New-MockPath -Location '/Users/Jan/Git/Somewhere' -ProviderName 'FileSystem' -DriveName '/' 227 | Get-ShortPath $path | Should Be "$($ThemeSettings.PromptSymbols.HomeSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)$($ThemeSettings.PromptSymbols.TruncatedFolderSymbol)$($ThemeSettings.PromptSymbols.PathSeparator)Somewhere" 228 | } 229 | } 230 | } 231 | } 232 | 233 | Describe "Test-NotDefaultUser" { 234 | Context "With default user set" { 235 | BeforeAll { $DefaultUser = 'name' } 236 | It "same username gives 'false'" { 237 | $user = 'name' 238 | Test-NotDefaultUser($user) | Should Be $false 239 | } 240 | It "different username gives 'false'" { 241 | $user = 'differentName' 242 | Test-NotDefaultUser($user) | Should Be $true 243 | } 244 | It "same username and outside VirtualEnv gives 'false'" { 245 | Mock Test-VirtualEnv { return $false } 246 | $user = 'name' 247 | Test-NotDefaultUser($user) | Should Be $false 248 | } 249 | It "same username and inside VirtualEnv same default user gives 'false'" { 250 | Mock Test-VirtualEnv { return $true } 251 | $user = 'name' 252 | Test-NotDefaultUser($user) | Should Be $false 253 | } 254 | It "different username and inside VirtualEnv same default user gives 'true'" { 255 | Mock Test-VirtualEnv { return $true } 256 | $user = 'differentName' 257 | Test-NotDefaultUser($user) | Should Be $true 258 | } 259 | } 260 | Context "With no default user set" { 261 | BeforeAll { $DefaultUser = $null } 262 | It "no username gives 'true'" { 263 | Test-NotDefaultUser | Should Be $true 264 | } 265 | It "different username gives 'true'" { 266 | $user = 'differentName' 267 | Test-NotDefaultUser($user) | Should Be $true 268 | } 269 | It "different username and outside VirtualEnv gives 'true'" { 270 | Mock Test-VirtualEnv { return $false } 271 | $user = 'differentName' 272 | Test-NotDefaultUser($user) | Should Be $true 273 | } 274 | It "no username and inside VirtualEnv gives 'true'" { 275 | Mock Test-VirtualEnv { return $true } 276 | Test-NotDefaultUser($user) | Should Be $true 277 | } 278 | } 279 | } 280 | -------------------------------------------------------------------------------- /Helpers/Prompt.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Defines whether or not the current terminal supports ANSI characters 4 | .DESCRIPTION 5 | Logic taken from posh-git that sets the $GitPromptSettings.AnsiConsole bool: 6 | [bool]$AnsiConsole = $Host.UI.SupportsVirtualTerminal -or ($Env:ConEmuANSI -eq "ON") 7 | #> 8 | function Test-IsVanillaWindow { 9 | $hasAnsiSupport = (Test-AnsiTerminal) -or ($Env:ConEmuANSI -eq "ON") -or ($env:PROMPT) -or ($env:TERM_PROGRAM -eq "Hyper") -or ($env:TERM_PROGRAM -eq "vscode") 10 | return !$hasAnsiSupport 11 | } 12 | 13 | function Test-AnsiTerminal { 14 | return $Host.UI.SupportsVirtualTerminal 15 | } 16 | 17 | function Test-PsCore { 18 | return $PSVersionTable.PSVersion.Major -gt 5 19 | } 20 | 21 | function Test-Windows { 22 | $PSVersionTable.Platform -ne 'Unix' 23 | } 24 | 25 | function Get-Home { 26 | # On Unix systems, $HOME comes with a trailing slash, unlike the Windows variant 27 | return $HOME.TrimEnd('/', '\') 28 | } 29 | 30 | function Test-Administrator { 31 | if ($PSVersionTable.Platform -eq 'Unix') { 32 | return (whoami) -eq 'root' 33 | } 34 | elseif ($PSVersionTable.Platform -eq 'Windows') { 35 | return $false #TO-DO: find out how to distinguish this one 36 | } 37 | else { 38 | return ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator') 39 | } 40 | } 41 | 42 | function Get-ComputerName { 43 | if (Test-PsCore -And -Not Test-Windows) { 44 | if ($env:COMPUTERNAME) { 45 | return $env:COMPUTERNAME 46 | } 47 | if ($env:NAME) { 48 | return $env:NAME 49 | } 50 | return (uname -n) 51 | } 52 | return $env:COMPUTERNAME 53 | } 54 | 55 | function Get-Provider { 56 | param( 57 | [Parameter(Mandatory = $true)] 58 | [System.Management.Automation.PathInfo] 59 | $dir 60 | ) 61 | 62 | return $dir.Provider.Name 63 | } 64 | 65 | function Get-FormattedRootLocation { 66 | param( 67 | [Parameter(Mandatory = $true)] 68 | [System.Management.Automation.PathInfo] 69 | $dir 70 | ) 71 | 72 | $provider = Get-Provider -dir $dir 73 | 74 | if ($provider -eq 'FileSystem') { 75 | $homedir = Get-Home 76 | if ($dir.Path.StartsWith($homedir)) { 77 | return $sl.PromptSymbols.HomeSymbol 78 | } 79 | if ($dir.Path.StartsWith('Microsoft.PowerShell.Core')) { 80 | return $sl.PromptSymbols.UNCSymbol 81 | } 82 | return '' 83 | } 84 | else { 85 | return $dir.Drive.Name 86 | } 87 | } 88 | 89 | function Test-IsVCSRoot { 90 | param( 91 | [System.String] 92 | $Path 93 | ) 94 | 95 | return (Test-Path -LiteralPath "$($Path)\.git") -Or (Test-Path -LiteralPath "$($Path)\.hg") -Or (Test-Path -LiteralPath "$($Path)\.svn") 96 | } 97 | 98 | function Get-FullPath { 99 | param( 100 | [Parameter(Mandatory = $true)] 101 | [System.Management.Automation.PathInfo] 102 | $dir, 103 | 104 | [Parameter(Mandatory = $false)] 105 | [switch] 106 | $noHomeAbbreviation 107 | ) 108 | 109 | if ($dir.path -eq "$($dir.Drive.Name):\") { 110 | return "$($dir.Drive.Name):" 111 | } 112 | 113 | if ($noHomeAbbreviation.IsPresent) { 114 | $path = $dir.path 115 | } 116 | else { 117 | $path = $dir.path.Replace((Get-Home), $sl.PromptSymbols.HomeSymbol) 118 | } 119 | $path = $path.Replace('\', $sl.PromptSymbols.PathSeparator) 120 | 121 | return $path 122 | } 123 | 124 | function Get-OSPathSeparator { 125 | return [System.IO.Path]::DirectorySeparatorChar 126 | } 127 | 128 | function Get-ShortPath { 129 | param( 130 | [Parameter(Mandatory = $true)] 131 | [System.Management.Automation.PathInfo] 132 | $dir 133 | ) 134 | 135 | $provider = Get-Provider -dir $dir 136 | 137 | if ($provider -eq 'FileSystem') { 138 | # on UNIX systems, a trailing slash can be present, yet when calling $HOME there isn't one 139 | $path = $dir.Path.TrimEnd((Get-OSPathSeparator)) 140 | # list known paths and their substitutes 141 | $knownPaths = (Get-Home), 'Microsoft.PowerShell.Core\FileSystem::' 142 | $result = @() 143 | while ($path -And -Not ($knownPaths.Contains($path))) { 144 | $folder = $path.Split((Get-OSPathSeparator))[-1] 145 | if ( (Test-IsVCSRoot -Path $path) -Or ($result.length -eq 0) -Or -Not ($path.Contains((Get-OSPathSeparator)))) { 146 | $result = , $folder + $result 147 | } 148 | else { 149 | $result = , $sl.PromptSymbols.TruncatedFolderSymbol + $result 150 | } 151 | # remove the last element 152 | $path = $path.TrimEnd($folder).TrimEnd((Get-OSPathSeparator)) 153 | } 154 | $shortPath = $result -join $sl.PromptSymbols.PathSeparator 155 | $rootLocation = (Get-FormattedRootLocation -dir $dir) 156 | if ($rootLocation -and $shortPath) { 157 | return "$rootLocation$($sl.PromptSymbols.PathSeparator)$shortPath" 158 | } 159 | if ($rootLocation) { 160 | return $rootLocation 161 | } 162 | return $shortPath 163 | } 164 | else { 165 | return $dir.path.Replace((Get-FormattedRootLocation -dir $dir), '') 166 | } 167 | } 168 | function Test-VirtualEnv { 169 | if ($env:VIRTUAL_ENV) { 170 | return $true 171 | } 172 | if ($Env:CONDA_PROMPT_MODIFIER) { 173 | return $true 174 | } 175 | return $false 176 | } 177 | 178 | function Get-VirtualEnvName { 179 | # Suppress prompt from virtualenv 180 | $env:VIRTUAL_ENV_DISABLE_PROMPT="True" 181 | 182 | if ($env:VIRTUAL_ENV) { 183 | if ($PSVersionTable.Platform -eq 'Unix') { 184 | $virtualEnvName = ($env:VIRTUAL_ENV -split '/')[-1] 185 | } elseif ($PSVersionTable.Platform -eq 'Win32NT' -or $PSEdition -eq 'Desktop') { 186 | $virtualEnvName = ($env:VIRTUAL_ENV -split '\\')[-1] 187 | } else { 188 | $virtualEnvName = $env:VIRTUAL_ENV 189 | } 190 | return $virtualEnvName.Trim('[\/]') 191 | } 192 | elseif ($Env:CONDA_PROMPT_MODIFIER) { 193 | [regex]::Match($Env:CONDA_PROMPT_MODIFIER, "^\((.*)\)").Captures.Groups[1].Value; 194 | } 195 | } 196 | 197 | function Test-NotDefaultUser($user) { 198 | return $null -eq $DefaultUser -or $user -ne $DefaultUser 199 | } 200 | 201 | function Set-CursorForRightBlockWrite { 202 | param( 203 | [int] 204 | $textLength 205 | ) 206 | 207 | $rawUI = $Host.UI.RawUI 208 | $width = $rawUI.BufferSize.Width 209 | $space = $width - $textLength 210 | Write-Prompt "$escapeChar[$($space)G" 211 | } 212 | 213 | function Reset-CursorPosition { 214 | $postion = $host.UI.RawUI.CursorPosition 215 | $postion.X = 0 216 | $host.UI.RawUI.CursorPosition = $postion 217 | } 218 | 219 | function Set-CursorUp { 220 | param( 221 | [int] 222 | $lines 223 | ) 224 | return "$escapeChar[$($lines)A" 225 | } 226 | 227 | function Set-Newline { 228 | return Write-Prompt "`n" 229 | } 230 | 231 | function Get-BatteryInfo { 232 | if ($env:OS -eq 'Windows_NT' -or $IsWindows) { 233 | $cimSession = New-CimSession 234 | $batteryclass = Get-CimInstance win32_battery -Property EstimatedChargeRemaining -CimSession $cimSession 235 | if (!$batteryclass) { return } 236 | 237 | $powerclass = Get-CimInstance -Class batterystatus -Namespace root\wmi -Property PowerOnline,Charging -CimSession $cimSession 238 | $charge = $batteryclass.EstimatedChargeRemaining 239 | $connected = $powerclass.PowerOnline 240 | $charging = $powerclass.Charging 241 | 242 | } elseif ($IsLinux) { 243 | 244 | $syspath = "/sys/class/power_supply/" 245 | $syspathcontents = Get-ChildItem $syspath 246 | if (!$syspathcontents) { return } 247 | 248 | $powerclass = ($syspathcontents | Where-Object { $_.Name -like 'AC*' }).Name 249 | if ($powerclass -is [Object[]]) { $powerdevice = $syspath + $powerclass[-1] } 250 | else { $powerdevice = $syspath + $powerclass } 251 | $connected = Get-Content "$powerdevice/online" 252 | 253 | $batteryclass = ($syspathcontents | Where-Object { $_.Name -like 'BAT*' }).Name 254 | if ($batteryclass -is [Object[]]) { $batterydevice = $syspath + $batteryclass[-1] } 255 | else { $batterydevice = $syspath + $batteryclass } 256 | $charge = Get-Content "$batterydevice/capacity" 257 | $chargestatus = Get-Content "$batterydevice/status" 258 | if ($chargestatus -eq "Charging" -or $chargestatus -eq "Full") { $charging = 1 } 259 | else { $charging = 0 } 260 | 261 | } elseif ($IsMacOS) { 262 | 263 | $powercommand = pmset -g ps 264 | if ($powercommand[1] -notlike "*InternalBattery*") { "" } 265 | 266 | $charge = $powercommand[1].Split()[3].TrimEnd('%;') 267 | if ($powercommand[1].Split()[4].TrimEnd(';') -like 'charging') { $charging = 1 } 268 | else { $charging = 0 } 269 | if ($powercommand[0] -like '*Battery*') { $connected = 0 } 270 | else { $connected = 1 } 271 | 272 | } else { return } 273 | 274 | if ($connected) { 275 | if ($charging) { $batteryhex = 0xf583 } 276 | else { $batteryhex = 0xf582 } 277 | } else { 278 | [int]$level = $charge / 10 279 | switch ($level) { 280 | 0 { $batteryhex = 0xf58d } 281 | 1 { $batteryhex = 0xf579 } 282 | 2 { $batteryhex = 0xf57a } 283 | 3 { $batteryhex = 0xf57b } 284 | 4 { $batteryhex = 0xf57c } 285 | 5 { $batteryhex = 0xf57d } 286 | 6 { $batteryhex = 0xf57e } 287 | 7 { $batteryhex = 0xf57f } 288 | 8 { $batteryhex = 0xf580 } 289 | 9 { $batteryhex = 0xf581 } 290 | Default { $batteryhex = 0xf578 } 291 | } 292 | } 293 | $battery = [char]::ConvertFromUtf32($batteryhex) 294 | return "$charge% $battery" 295 | } 296 | 297 | $escapeChar = [char]27 298 | $sl = $global:ThemeSettings #local settings 299 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Jan De Dobbeleer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # oh-my-posh 2 | 3 | [![Build status][build-status-badge]][build-status] 4 | [![Travis build status][travis-build-status-badge]][travis-build-status] 5 | [![Coverage Status][coverage-status-badge]][coverage-status] 6 | [![Gitter][gitter-badge]][gitter] 7 | [![PS Gallery][psgallery-badge]][powershell-gallery] 8 | 9 | ## ❤ Support ❤ 10 | 11 | [![Patreon][patreon-badge]][patreon] 12 | [![Liberapay][liberapay-badge]][liberapay] 13 | [![Ko-Fi][kofi-badge]][kofi] 14 | 15 | ## Introducing V3 and what it means for V2 16 | 17 | It's been an amazing ride for Oh myPosh, but the time has come to step it up a notch. 18 | Developers nowadays no longer stick to one shell/language, they are all tools we use to solve a certain problem. 19 | The same needs to apply to Oh my Posh. It's time to adjust to that philosophy. 20 | 21 | That's why this version of Oh my Posh is entering maintenance mode while I'm working hard on getting [V3][v3] out of the door. 22 | Given that [V3][v3] is entirely different under the hood, it's hosted [separately][v3] for now. 23 | From a user perspective, it should give the same experience out-of-the-box, with the added advantage 24 | that custom themes are a first class, no code citizen. 25 | 26 | ```powershell 27 | Install-Module oh-my-posh -Scope CurrentUser -AllowPrerelease 28 | ``` 29 | 30 | [Documentation][docs-v3] is also available which should give a better experience than this **README** has over the past few years :-) 31 | 32 | If you're a developer looking to add functionality, please have a look at [V3][v3] to see if it already exists there. 33 | If not, feel free to create an issue or PR on [V3][v3], _**I will only be accepting bug fixes on V2 from now on**_. 34 | 35 | ## Table of Contents 36 | 37 | - [About](#about) 38 | - [Prerequisites](#prerequisites) 39 | - [Installation](#installation) 40 | - [Configuration](#configuration) 41 | - [Helper functions](#helper-functions) 42 | - [Themes](#themes) 43 | 44 | ## About 45 | 46 | A theme engine for Powershell inspired by the work done by Chris Benti on [PS-Config][chrisbenti-psconfig] and [Oh-My-ZSH][oh-my-zsh] on OSX and Linux (hence the name). 47 | 48 | More information about why I made this can be found on my [blog]. 49 | 50 | ![Theme][img-indications] 51 | 52 | Features: 53 | 54 | - Easy installation 55 | - Awesome prompt themes for PowerShell in ConEmu 56 | - Git status indications (powered by posh-git) 57 | - Failed command indication 58 | - Admin indication 59 | - Current session indications (admin, failed command, user) 60 | - Configurable 61 | - Easily create your own theme 62 | - Separate settings for oh-my-posh and posh-git 63 | - Does not mess with the default Powershell console 64 | 65 | ## Prerequisites 66 | 67 | You should use a modern console host like [ConEmu][conemu], [Alacritty][alacritty], [Terminus][terminus], [Hyper][hyper], [FluentTerminal][fluentterminal], or the official [Windows Terminal][windowsterminal] to have a great terminal experience on Windows. 68 | 69 | There are multiple ways to acquire Windows Terminal - from the Microsoft [Store](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701), the GitHub [repo](https://github.com/microsoft/terminal/releases), or the below commandline methods: 70 | 71 | Via [WinGet][winget] (official package manager for Windows): 72 | 73 | ```powershell 74 | winget install --id=Microsoft.WindowsTerminal -e 75 | ``` 76 | 77 | Via [Chocolatey][chocolatey]: 78 | 79 | ```powershell 80 | choco install microsoft-windows-terminal 81 | ``` 82 | 83 | Via [Scoop][scoop]: 84 | 85 | ```powershell 86 | scoop install windows-terminal 87 | ``` 88 | 89 | The fonts I use are Powerline fonts, there is a great [repository][nerdfonts] containing them. 90 | I use `Meslo LG M Regular for Powerline Nerd Font` in my ConEmu setup together with custom colors. You can find my theme [here][theme-gist]. 91 | 92 | In case you notice weird glyphs after installing a font of choice, make sure the glyphs are available (maybe they have a different location in the font, if so, adjust the correct `$ThemeSettings` icon). If it turns out the character you want is not supported, select a different font. 93 | 94 | ## Installation 95 | 96 | You need to use the [PowerShell Gallery][powershell-gallery] to install oh-my-posh. 97 | 98 | Install posh-git and oh-my-posh: 99 | 100 | ```powershell 101 | Install-Module posh-git -Scope CurrentUser 102 | Install-Module oh-my-posh -Scope CurrentUser 103 | ``` 104 | 105 | Enable the prompt: 106 | 107 | ```powershell 108 | # Start the default settings 109 | Set-Prompt 110 | # Alternatively set the desired theme: 111 | Set-Theme Agnoster 112 | ``` 113 | 114 | In case you're running this on PS Core, make sure to also install version 2.0.0-beta1 of `PSReadLine` 115 | 116 | ```powershell 117 | Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck 118 | ``` 119 | 120 | To enable the engine edit your PowerShell profile: 121 | 122 | ```powershell 123 | if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force } 124 | notepad $PROFILE 125 | ``` 126 | 127 | Append the following lines to your PowerShell profile: 128 | 129 | ```powershell 130 | Import-Module posh-git 131 | Import-Module oh-my-posh 132 | Set-Theme Paradox 133 | ``` 134 | 135 | The last command sets the theme for the console. Check the available themes list below. 136 | 137 | ## Configuration 138 | 139 | List the current configuration: 140 | 141 | ```powershell 142 | $ThemeSettings 143 | ``` 144 | 145 | ![Theme][img-themesettings] 146 | 147 | You can tweak the settings by manipulating `$ThemeSettings`. 148 | This example allows you to tweak the branch symbol using a unicode character: 149 | 150 | ```powershell 151 | $ThemeSettings.GitSymbols.BranchSymbol = [char]::ConvertFromUtf32(0xE0A0) 152 | ``` 153 | 154 | Also do not forget the Posh-Git settings itself (enable the stash indication for example): 155 | 156 | ```powershell 157 | $GitPromptSettings 158 | ``` 159 | 160 | Hide your `username@domain` when not in a virtual machine for the Agnoster, Fish, Honukai, Paradox and Sorin themes: 161 | 162 | ```powershell 163 | $DefaultUser = 'yourUsernameHere' 164 | ``` 165 | 166 | ## Helper functions 167 | 168 | `Set-Theme`: set a theme from the Themes directory. If no match is found, it will not be changed. Autocomplete is available to list and complete available themes. 169 | 170 | ```powershell 171 | Set-Theme paradox 172 | ``` 173 | 174 | `Show-ThemeColors`: display the colors used by the theme 175 | 176 | ![Theme][img-themecolors] 177 | 178 | `Show-Colors`: display colors configured in ConEmu 179 | 180 | ![Theme][img-showcolors] 181 | 182 | ## Themes 183 | 184 | ### Agnoster 185 | 186 | ![Agnoster Theme][img-theme-agnoster] 187 | 188 | ### Paradox 189 | 190 | ![Paradox Theme][img-theme-paradox] 191 | 192 | ### Sorin 193 | 194 | ![Sorin Theme][img-theme-sorin] 195 | 196 | ### Darkblood 197 | 198 | ![Darkblood Theme][img-theme-darkblood] 199 | 200 | ### Avit 201 | 202 | ![Avit Theme][img-theme-avit] 203 | 204 | ### Honukai 205 | 206 | ![Honukai Theme][img-theme-honukai] 207 | 208 | ### Fish 209 | 210 | ![Fish Theme][img-theme-fish] 211 | 212 | ### Robbyrussell 213 | 214 | ![Robbyrussell Theme][img-theme-robbyrussell] 215 | 216 | ### Pararussel 217 | 218 | ![Pararussel Theme][img-theme-pararussell] 219 | 220 | ### Material 221 | 222 | ![Material Theme][img-theme-material] 223 | ![Material Theme][img-theme-material2] 224 | 225 | ### Star 226 | 227 | ![Star Theme][img-theme-star] 228 | 229 | ### Zash 230 | 231 | ![Star Theme][img-theme-zash] 232 | 233 | ### Lambda 234 | 235 | ![Lambda Theme](./img/lambda.png) 236 | 237 | ### Emodipt 238 | 239 | ![Emodipt Theme][img-theme-emodipt] 240 | 241 | ### Operator 242 | 243 | ![Operator Theme][img-theme-operator] 244 | 245 | ## Creating your own theme 246 | 247 | If you want to create a theme it can be done rather easily by adding a `mytheme.psm1` file in the folder indicated in `$ThemeSettings.MyThemesLocation` (the folder defaults to `~\Documents\WindowsPowerShell\PoshThemes`, feel free to change it). 248 | 249 | The only required function is `Write-Theme`. You can use the following template to get started: 250 | 251 | ```powershell 252 | #requires -Version 2 -Modules posh-git 253 | 254 | function Write-Theme 255 | { 256 | param( 257 | [bool] 258 | $lastCommandFailed, 259 | [string] 260 | $with 261 | ) 262 | 263 | # enter your prompt building logic here 264 | } 265 | 266 | $sl = $global:ThemeSettings #local settings 267 | ``` 268 | 269 | Feel free to use the public helper functions `Get-VCSStatus`, `Get-VcsInfo`, `Get-FormattedRootLocation`, `Get-ShortPath`, `Set-CursorForRightBlockWrite`, `Set-CursorUp`, `Set-Newline` or add your own logic completely. 270 | 271 | To test the output in ConEmu, just switch to your theme: 272 | 273 | ```powershell 274 | Set-Theme mytheme 275 | ``` 276 | 277 | If you want to include your theme in oh-my-posh, send me a PR and I'll try to give feedback ASAP. 278 | 279 | Happy theming! 280 | 281 | ### Adding stack count to a custom theme 282 | 283 | As it seems getting access to the stack information when using pushd/popd is sort of mission impossible from within a theme, you can use a workaround proposed by [Jonathan Leech-Pepin][jleechpe]. In your `$PROFILE`, add a variable that will act as a correctly scoped pointer to fetch the stack context: 284 | 285 | ```powershell 286 | $getStackContext = {Get-Location -Stack} 287 | ``` 288 | 289 | Next, in your custom theme, access the information you want to display: 290 | 291 | ```powershell 292 | $stackCount = (&$getStackContext).count 293 | ``` 294 | 295 | ### iTerm2 is creating notifications every time 296 | 297 | This is caused by the `ConsoleTitle` functionality. 298 | As explained by [Andrew Stanton-Nurse][consoletitle] it's linked to how terminals work with OSC codes. 299 | The fix is to disable the `ConsoleTitle` functionality when in iTerm2 by adding the following snippet to your `$PROFILE`. 300 | 301 | ```powershell 302 | if($env:LC_TERMINAL -eq "iTerm2") { 303 | $ThemeSettings.Options.ConsoleTitle = $false 304 | } 305 | ``` 306 | 307 | ### Based on work by 308 | 309 | - [Chris Benti][chrisbenti-psconfig] 310 | - [Keith Dahlby][keithdahlby-poshgit] 311 | 312 | [build-status-badge]: https://img.shields.io/appveyor/ci/janjoris/oh-my-posh2/master.svg?maxAge=2592000 313 | [build-status]: https://ci.appveyor.com/project/JanJoris/oh-my-posh2 314 | [travis-build-status-badge]: https://travis-ci.org/JanDeDobbeleer/oh-my-posh2.svg?branch=master 315 | [travis-build-status]: https://travis-ci.org/JanDeDobbeleer/oh-my-posh2 316 | [coverage-status-badge]: https://coveralls.io/repos/github/JanDeDobbeleer/oh-my-posh2/badge.svg 317 | [coverage-status]: https://coveralls.io/github/JanDeDobbeleer/oh-my-posh2 318 | [gitter-badge]: https://badges.gitter.im/oh-my-posh/Lobby.svg 319 | [gitter]: https://gitter.im/oh-my-posh/general?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge 320 | [psgallery-badge]: https://img.shields.io/powershellgallery/dt/oh-my-posh.svg 321 | [powershell-gallery]: https://www.powershellgallery.com/packages/oh-my-posh/ 322 | [patreon-badge]: https://img.shields.io/badge/Support-Become%20a%20Patreon!-red.svg 323 | [patreon]: https://www.patreon.com/jandedobbeleer 324 | [liberapay-badge]: https://img.shields.io/badge/Liberapay-Donate-%23f6c915.svg 325 | [liberapay]: https://liberapay.com/jandedobbeleer 326 | [kofi-badge]: https://img.shields.io/badge/Ko--fi-Buy%20me%20a%20coffee!-%2346b798.svg 327 | [kofi]: https://ko-fi.com/jandedobbeleer 328 | [scoop]: https://scoop.sh/ 329 | [scoop-extras]: https://github.com/lukesampson/scoop/wiki/Buckets 330 | [windowsterminal]: https://github.com/microsoft/terminal 331 | [conemu]: https://conemu.github.io/ 332 | [alacritty]: https://github.com/alacritty/alacritty 333 | [terminus]: https://eugeny.github.io/terminus/ 334 | [fluentterminal]: https://github.com/felixse/FluentTerminal 335 | [hyper]: https://hyper.is/ 336 | [winget]: https://github.com/microsoft/winget-cli 337 | [chrisbenti-psconfig]: https://github.com/chrisbenti/PS-Config 338 | [keithdahlby-poshgit]: https://github.com/dahlbyk/posh-git 339 | [jleechpe]: https://github.com/jleechpe 340 | [oh-my-zsh]: https://github.com/robbyrussell/oh-my-zsh 341 | [blog]: https://blog.itdepends.be/shell-shock/ 342 | [chocolatey]: https://chocolatey.org/ 343 | [nerdfonts]: https://github.com/ryanoasis/nerd-fonts 344 | [theme-gist]: https://gist.github.com/JanDeDobbeleer/71c9f1361a562f337b855b75d7bbfd28 345 | [img-indications]: img/indications.png 346 | [img-themesettings]: img/themesettings.png 347 | [img-themecolors]: img/themecolors.png 348 | [img-showcolors]: img/showcolors.png 349 | [img-theme-agnoster]: img/agnoster.png 350 | [img-theme-paradox]: img/paradox.png 351 | [img-theme-sorin]: img/sorin.png 352 | [img-theme-darkblood]: img/darkblood.png 353 | [img-theme-avit]: img/avit.png 354 | [img-theme-honukai]: img/honukai.png 355 | [img-theme-fish]: img/fish.png 356 | [img-theme-robbyrussell]: img/robbyrussel.png 357 | [img-theme-pararussell]: img/pararussel.png 358 | [img-theme-material]: img/material.png 359 | [img-theme-material2]: img/material2.png 360 | [img-theme-star]: img/star.png 361 | [img-theme-zash]: img/zash.png 362 | [img-theme-emodipt]: img/emodipt.png 363 | [img-theme-operator]: img/operator.png 364 | [consoletitle]: https://github.com/JanDeDobbeleer/oh-my-posh2/issues/261#issuecomment-649701607 365 | [v3]: https://github.com/JanDeDobbeleer/oh-my-posh3 366 | [docs-v3]: https://ohmyposh.dev 367 | -------------------------------------------------------------------------------- /Themes/Agnoster.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | 5 | param( 6 | [bool] 7 | $lastCommandFailed, 8 | [string] 9 | $with 10 | ) 11 | 12 | $lastColor = $sl.Colors.PromptBackgroundColor 13 | 14 | $prompt='' 15 | 16 | if($sl.PromptSymbols.StartSymbol -ne ' ') { 17 | $prompt += Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 18 | } 19 | 20 | #check the last command state and indicate if failed 21 | If ($lastCommandFailed) { 22 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 23 | } 24 | 25 | #check for elevated prompt 26 | If (Test-Administrator) { 27 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 28 | } 29 | 30 | $user = $sl.CurrentUser 31 | $computer = $sl.CurrentHostname 32 | if (Test-NotDefaultUser($user)) { 33 | $prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 34 | } 35 | 36 | if (Test-VirtualEnv) { 37 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 38 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 39 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.VirtualEnvBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 40 | } 41 | else { 42 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 43 | } 44 | 45 | # Writes the drive portion 46 | $prompt += Write-Prompt -Object (Get-ShortPath -dir $pwd) -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 47 | $prompt += Write-Prompt -Object ' ' -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 48 | 49 | $status = Get-VCSStatus 50 | if ($status) { 51 | $themeInfo = Get-VcsInfo -status ($status) 52 | $lastColor = $themeInfo.BackgroundColor 53 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $lastColor 54 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -BackgroundColor $lastColor -ForegroundColor $sl.Colors.GitForegroundColor 55 | } 56 | 57 | if ($with) { 58 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor -BackgroundColor $sl.Colors.WithBackgroundColor 59 | $prompt += Write-Prompt -Object " $($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 60 | $lastColor = $sl.Colors.WithBackgroundColor 61 | } 62 | 63 | # Writes the postfix to the prompt 64 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor 65 | $prompt += ' ' 66 | $prompt 67 | } 68 | 69 | $sl = $global:ThemeSettings #local settings 70 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 71 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 72 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 73 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 74 | $sl.Colors.GitForegroundColor = [ConsoleColor]::Black 75 | $sl.Colors.WithForegroundColor = [ConsoleColor]::White 76 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed 77 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red 78 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 79 | -------------------------------------------------------------------------------- /Themes/AgnosterPlus.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | # path 12 | $sPath = "$(Get-FullPath -dir $pwd) " 13 | #$getStackContext = {Get-Location -Stack} 14 | #$stackCount = (&$getStackContext).count 15 | 16 | # check for elevated prompt 17 | $sAdmin = "" 18 | If (Test-Administrator) { 19 | $sAdmin = " $($sl.PromptSymbols.ElevatedSymbol)" 20 | } 21 | 22 | # timestamp 23 | $sTime = " $(Get-Date -Format HH:mm:ss)" 24 | 25 | # check the last command state and indicate if failed 26 | $sFailed = "" 27 | If ($lastCommandFailed) { 28 | $sFailed = " $($sl.PromptSymbols.FailedCommandSymbol)" 29 | } 30 | 31 | # virtualenv 32 | $sVenv = "" 33 | If (Test-VirtualEnv) { 34 | $sVenv = " $(Get-VirtualEnvName)" 35 | } 36 | 37 | # with 38 | $sWith = "" 39 | If ($with) { 40 | $sWith = " $($with.ToUpper())" 41 | } 42 | 43 | $rightPrompt = "$sFailed$sWith$sVenv$sAdmin$sTime" 44 | $prompt = "" 45 | $prompt += Set-CursorForRightBlockWrite -textLength $rightPrompt.Length 46 | $prompt += Write-Prompt -Object $sFailed -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 47 | $prompt += Write-Prompt -Object $sWith -ForegroundColor $sl.Colors.WithForegroundColor 48 | 49 | $prompt += Write-Prompt -Object $sVenv -ForegroundColor $sl.Colors.VirtualEnvForegroundColor 50 | $prompt += Write-Prompt -Object $sAdmin -ForegroundColor $sl.Colors.AdminIconForegroundColor 51 | $prompt += Write-Prompt -Object $sTime -ForegroundColor $sl.colors.TimestampForegroundColor 52 | $prompt += Write-Prompt -Object "`r" 53 | 54 | $lastColor = $sl.Colors.PromptBackgroundColor 55 | $prompt += Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 56 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 57 | $prompt += Write-Prompt -Object " $($sPath)" -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $lastColor 58 | 59 | 60 | # git info 61 | $vcsStatus = Get-VCSStatus 62 | if ($vcsStatus) { 63 | $vcsInfo = Get-VcsInfo -status $vcsStatus 64 | $lastColor = $vcsInfo.BackgroundColor 65 | 66 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $lastColor 67 | 68 | if (!$sl.ColorizeVcInfoItems) { 69 | $prompt += Write-Prompt -Object " $($vcsInfo.VcInfo) " -ForegroundColor $sl.Colors.GitForegroundColor -BackgroundColor $lastColor 70 | } 71 | else { 72 | $settings = $global:GitPromptSettings 73 | 74 | # Get the GIT Status Items 75 | $prompt2 = "" 76 | if ($settings.DefaultPromptWriteStatusFirst) { 77 | $prompt2 += Write-Prompt $settings.PathStatusSeparator -BackgroundColor $lastColor 78 | } 79 | 80 | $prompt2 += Write-Prompt -Object " $($sl.GitSymbols.BranchSymbol) " -ForegroundColor $sl.Colors.GitForegroundColor -BackgroundColor $lastColor 81 | $prompt2 += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor -BackgroundColor $global:settings.BranchColor.BackgroundColor 82 | 83 | $prompt2 += Write-GitBranchName $vcsStatus 84 | $prompt2 += Write-GitBranchStatus $vcsStatus 85 | $prompt2 += Write-Prompt $settings.BeforeIndex 86 | if ($settings.EnableFileStatus) { 87 | if ($vcsStatus.HasIndex) { 88 | $prompt2 += Write-GitIndexStatus $vcsStatus 89 | } 90 | 91 | if ($vcsStatus.HasWorking) { 92 | $prompt2 += Write-Prompt $settings.DelimStatus.Text -ForegroundColor $sl.Colors.GitForegroundColor 93 | $prompt2 += Write-GitWorkingDirStatus $vcsStatus 94 | } 95 | } 96 | 97 | $prompt2 += Write-GitWorkingDirStatusSummary $vcsStatus 98 | 99 | if ($settings.EnableStashStatus -and ($vcsStatus.StashCount -gt 0)) { 100 | $prompt2 += Write-GitStashCount $vcsStatus 101 | } 102 | 103 | # When status is first, place the separator after the status summary 104 | if (!$settings.DefaultPromptWriteStatusFirst) { 105 | $prompt2 += Write-Prompt $settings.PathStatusSeparator -BackgroundColor $lastColor 106 | } 107 | 108 | $prompt += Write-Prompt -Object $prompt2 -BackgroundColor $lastColor 109 | } 110 | } 111 | 112 | If ($sl.DoubleCommandLine) { 113 | $prompt += Set-Newline 114 | } 115 | 116 | # Writes the postfixes to the prompt 117 | $indicatorColor = If ($lastCommandFailed) { $sl.Colors.CommandFailedIconForegroundColor } Else { $lastColor } 118 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $indicatorColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 119 | $prompt += ' ' 120 | $prompt 121 | } 122 | 123 | $sl = $global:ThemeSettings #local settings 124 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 125 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 126 | 127 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::DarkBlue 128 | $sl.Colors.GitDefaultColor = [ConsoleColor]::DarkGreen 129 | $sl.Colors.GitLocalChangesColor = [ConsoleColor]::DarkYellow 130 | $sl.Colors.GitNoLocalChangesAndAheadAndBehindColor = [ConsoleColor]::DarkRed 131 | $sl.Colors.GitNoLocalChangesAndAheadColor = [ConsoleColor]::DarkMagenta 132 | $sl.Colors.GitNoLocalChangesAndBehindColor = [ConsoleColor]::DarkRed 133 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 134 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 135 | $sl.Colors.SessionInfoBackgroundColor = [ConsoleColor]::Black 136 | $sl.Colors.SessionInfoForegroundColor = [ConsoleColor]::White 137 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed 138 | $sl.Colors.VirtualEnvBackgroundColor = [ConsoleColor]::Red 139 | 140 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 141 | $sl.Colors.WithForegroundColor = [ConsoleColor]::White 142 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 143 | $sl.Colors.TimestampForegroundColor = [ConsoleColor]::DarkCyan 144 | $sl.Colors.CommandFailedIconForegroundColor = [ConsoleColor]::DarkRed 145 | $sl.Colors.PromptBackgroundColor = [ConsoleColor]::DarkBlue 146 | 147 | if ($sl.ColorizeVcInfoItems) { 148 | $sl.Colors.GitForegroundColor = [ConsoleColor]::Black 149 | $sl.Colors.AdminIconForegroundColor = [ConsoleColor]::White 150 | } 151 | else { 152 | $sl.Colors.GitForegroundColor = [ConsoleColor]::DarkGray 153 | $sl.Colors.AdminIconForegroundColor = [ConsoleColor]::DarkYellow 154 | } 155 | 156 | $global:GitPromptSettings.EnableStashStatus = $true 157 | 158 | $sl | Add-Member -NotePropertyName DoubleCommandLine -NotePropertyValue 0 -Force 159 | $sl | Add-Member -NotePropertyName ColorizeVcInfoItems -NotePropertyValue 0 -Force 160 | -------------------------------------------------------------------------------- /Themes/Avit.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | 5 | param( 6 | [bool] 7 | $lastCommandFailed, 8 | [string] 9 | $with 10 | ) 11 | 12 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptForegroundColor 13 | 14 | $dir = Get-FullPath -dir $pwd 15 | 16 | $prompt += Write-Prompt -Object $dir -ForegroundColor $sl.Colors.PromptForegroundColor 17 | 18 | $status = Get-VCSStatus 19 | if ($status) { 20 | $vcsInfo = Get-VcsInfo -status ($status) 21 | $info = $vcsInfo.VcInfo 22 | $prompt += Write-Prompt -Object " $info" -ForegroundColor $vcsInfo.BackgroundColor 23 | } 24 | 25 | #check for elevated prompt 26 | If (Test-Administrator) { 27 | $prompt += Write-Prompt -Object " $($sl.PromptSymbols.ElevatedSymbol)" -ForegroundColor $sl.Colors.AdminIconForegroundColor 28 | } 29 | 30 | #check the last command state and indicate if failed 31 | If ($lastCommandFailed) { 32 | $prompt += Write-Prompt -Object " $($sl.PromptSymbols.FailedCommandSymbol)" -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 33 | } 34 | 35 | $timeStamp = Get-Date -Format T 36 | $clock = [char]::ConvertFromUtf32(0x25F7) 37 | $timestamp = "$clock $timeStamp" 38 | 39 | if ($status) { 40 | $timeStamp = Get-TimeSinceLastCommit 41 | } 42 | 43 | $prompt += Set-CursorForRightBlockWrite -textLength $timestamp.Length 44 | $prompt += Write-Prompt $timeStamp -ForegroundColor $sl.Colors.PromptBackgroundColor 45 | $prompt += Set-Newline 46 | 47 | if (Test-VirtualEnv) { 48 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor -ForegroundColor $sl.Colors.VirtualEnvForegroundColor 49 | } 50 | 51 | if ($with) { 52 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 53 | } 54 | 55 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.PromptBackgroundColor 56 | $prompt += ' ' 57 | $prompt 58 | } 59 | 60 | function Get-TimeSinceLastCommit { 61 | return (git log --pretty=format:'%cr' -1) 62 | } 63 | 64 | $sl = $global:ThemeSettings #local settings 65 | $sl.PromptSymbols.StartSymbol = '' 66 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x25B6) 67 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::DarkBlue 68 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 69 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 70 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 71 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 72 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Magenta 73 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::Red -------------------------------------------------------------------------------- /Themes/Darkblood.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | 5 | param( 6 | [bool] 7 | $lastCommandFailed, 8 | [string] 9 | $with 10 | ) 11 | 12 | $prompt = Write-Prompt -Object ([char]::ConvertFromUtf32(0x250C)) -ForegroundColor $sl.Colors.PromptSymbolColor 13 | $user = $sl.CurrentUser 14 | $computer = $sl.CurrentHostname 15 | $prompt += Write-Segment -content "$user@$computer" -foregroundColor $sl.Colors.PromptForegroundColor 16 | 17 | # $prompt += "$($sl.PromptSymbols.SegmentForwardSymbol) " 18 | 19 | $status = Get-VCSStatus 20 | if ($status) { 21 | $vcsInfo = Get-VcsInfo -status ($status) 22 | $info = $vcsInfo.VcInfo 23 | $prompt += Write-Segment -content $info -foregroundColor $sl.Colors.GitForegroundColor 24 | } 25 | 26 | #check for elevated prompt 27 | If (Test-Administrator) { 28 | $prompt += Write-Segment -content $sl.PromptSymbols.ElevatedSymbol -foregroundColor $sl.Colors.AdminIconForegroundColor 29 | } 30 | 31 | #check the last command state and indicate if failed 32 | If ($lastCommandFailed) { 33 | $prompt += Write-Segment -content $sl.PromptSymbols.FailedCommandSymbol -foregroundColor $sl.Colors.CommandFailedIconForegroundColor 34 | } 35 | 36 | $prompt += '' 37 | 38 | # SECOND LINE 39 | $prompt += Set-Newline 40 | $prompt += Write-Prompt -Object ([char]::ConvertFromUtf32(0x2514)) -ForegroundColor $sl.Colors.PromptSymbolColor 41 | $path += Get-FullPath -dir $pwd 42 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentBackwardSymbol -ForegroundColor $sl.Colors.PromptSymbolColor 43 | $prompt += Write-Prompt -Object $path -ForegroundColor $sl.Colors.PromptForegroundColor 44 | 45 | if (Test-VirtualEnv) { 46 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) $($sl.PromptSymbols.SegmentBackwardSymbol)" -ForegroundColor $sl.Colors.PromptSymbolColor 47 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName)" -ForegroundColor $sl.Colors.VirtualEnvForegroundColor 48 | } 49 | 50 | if ($with) { 51 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) $($sl.PromptSymbols.SegmentBackwardSymbol)" -ForegroundColor $sl.Colors.PromptSymbolColor 52 | $prompt += Write-Prompt -Object "$($with.ToUpper())" -ForegroundColor $sl.Colors.WithForegroundColor 53 | } 54 | 55 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol)$($sl.PromptSymbols.PromptIndicator)" -ForegroundColor $sl.Colors.PromptSymbolColor 56 | $prompt += ' ' 57 | $prompt 58 | } 59 | 60 | function Write-Segment { 61 | 62 | param( 63 | $content, 64 | $foregroundColor 65 | ) 66 | 67 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentBackwardSymbol -ForegroundColor $sl.Colors.PromptSymbolColor 68 | $prompt += Write-Prompt -Object $content -ForegroundColor $foregroundColor 69 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.PromptSymbolColor 70 | return $prompt 71 | } 72 | 73 | $sl = $global:ThemeSettings #local settings 74 | $sl.PromptSymbols.PromptIndicator = '>' 75 | $sl.PromptSymbols.SegmentForwardSymbol = ']' 76 | $sl.PromptSymbols.SegmentBackwardSymbol = '[' 77 | $sl.PromptSymbols.PathSeparator = '\' 78 | $sl.PromptSymbols.FailedCommandSymbol = 'x' 79 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 80 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::DarkRed 81 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 82 | $sl.Colors.GitForegroundColor = [ConsoleColor]::White 83 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkYellow 84 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 85 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Magenta 86 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 87 | -------------------------------------------------------------------------------- /Themes/Emodipt.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | # timestamp 12 | $prompt = Write-Prompt -Object "[ $(Get-Date -Format HH:mm:ss) ] " -ForegroundColor $sl.colors.TimestampForegroundColor 13 | 14 | # check for elevated prompt 15 | If (Test-Administrator) { 16 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " 17 | } 18 | 19 | # path 20 | $prompt += Write-Prompt -Object "$(Get-ShortPath -dir $pwd) " -ForegroundColor $sl.Colors.DriveForegroundColor 21 | 22 | # virtualenv 23 | If (Test-VirtualEnv) { 24 | $prompt += Write-Prompt -Object "$(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor 25 | } 26 | 27 | # git info 28 | If ($status = Get-VCSStatus) { 29 | $vcsInfo = Get-VcsInfo -status ($status) 30 | $prompt += Write-Prompt -Object "$($vcsInfo.VcInfo) " -ForegroundColor $vcsInfo.BackgroundColor 31 | } 32 | 33 | # with 34 | If ($with) { 35 | $prompt += Write-Prompt -Object " $($with.ToUpper()) " -ForegroundColor $sl.Colors.WithBackgroundColor 36 | } 37 | 38 | # Writes the postfixes to the prompt 39 | $indicatorColor = If ($lastCommandFailed) { $sl.Colors.CommandFailedIconForegroundColor } Else { $sl.Colors.PromptSymbolColor } 40 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $indicatorColor 41 | $prompt += ' ' 42 | $prompt 43 | } 44 | 45 | $sl = $global:ThemeSettings #local settings 46 | $sl.GitSymbols.BranchSymbol = [char]::ConvertFromUtf32(0x1F6A6) 47 | $sl.GitSymbols.BranchAheadStatusSymbol = [char]::ConvertFromUtf32(0x2B6B) 48 | $sl.GitSymbols.BranchBehindStatusSymbol = [char]::ConvertFromUtf32(0x2B6D) 49 | $sl.GitSymbols.BranchIdenticalStatusToSymbol = [char]::ConvertFromUtf32(0x2705) 50 | $sl.GitSymbols.BranchUntrackedSymbol = [char]::ConvertFromUtf32(0x274E) 51 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 52 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 53 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::Magenta 54 | $sl.Colors.TimestampForegroundColor = [ConsoleColor]::DarkYellow 55 | $sl | Add-Member -NotePropertyName DoubleCommandLine -NotePropertyValue 0 -Force 56 | -------------------------------------------------------------------------------- /Themes/Fish.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | $date = Get-Date -UFormat %d-%m-%Y 12 | $timeStamp = Get-Date -UFormat %R 13 | 14 | $leftText = "$($sl.PromptSymbols.SegmentBackwardSymbol) $date $($sl.PromptSymbols.SegmentSeparatorBackwardSymbol) $timeStamp " 15 | $prompt += Set-CursorUp -lines 1 16 | $prompt += Set-CursorForRightBlockWrite -textLength $leftText.Length 17 | 18 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentBackwardSymbol)" -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $sl.Colors.PromptHighlightColor 19 | $prompt += Write-Prompt " $date $($sl.PromptSymbols.SegmentSeparatorBackwardSymbol) $timeStamp " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 20 | 21 | # Write the prompt 22 | $prompt += Set-Newline 23 | $prompt += Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 24 | 25 | #check the last command state and indicate if failed 26 | If ($lastCommandFailed) { 27 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 28 | } 29 | 30 | # Check for elevated prompt 31 | If (Test-Administrator) { 32 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 33 | } 34 | 35 | $user = $sl.CurrentUser 36 | $computer = $sl.CurrentHostname 37 | $path = Get-FullPath -dir $pwd 38 | if (Test-NotDefaultUser($user)) { 39 | $prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 40 | } 41 | 42 | if (Test-VirtualEnv) { 43 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 44 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 45 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.VirtualEnvBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 46 | } 47 | else { 48 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 49 | } 50 | 51 | # Writes the drive portion 52 | $prompt += Write-Prompt -Object "$path " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 53 | 54 | $status = Get-VCSStatus 55 | if ($status) { 56 | $themeInfo = Get-VcsInfo -status ($status) 57 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentSeparatorForwardSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 58 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 59 | } 60 | 61 | if ($with) { 62 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentSeparatorForwardSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 63 | $prompt += Write-Prompt -Object " $($with.ToUpper()) " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 64 | } 65 | 66 | # Writes the postfix to the prompt 67 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.PromptBackgroundColor 68 | $prompt += ' ' 69 | $prompt 70 | } 71 | 72 | $sl = $global:ThemeSettings #local settings 73 | $sl.PromptSymbols.StartSymbol = '' 74 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 75 | $sl.PromptSymbols.SegmentBackwardSymbol = [char]::ConvertFromUtf32(0xE0B2) 76 | $sl.PromptSymbols.SegmentSeparatorForwardSymbol = [char]::ConvertFromUtf32(0xE0B1) 77 | $sl.PromptSymbols.SegmentSeparatorBackwardSymbol = [char]::ConvertFromUtf32(0xE0B3) 78 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 79 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 80 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Magenta 81 | $sl.Colors.GitForegroundColor = [ConsoleColor]::Black 82 | $sl.Colors.WithForegroundColor = [ConsoleColor]::White 83 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed 84 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red 85 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 86 | -------------------------------------------------------------------------------- /Themes/Honukai.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | # write # and space 12 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptHighlightColor 13 | # write user 14 | $user = $sl.CurrentUser 15 | if (Test-NotDefaultUser($user)) { 16 | $prompt += Write-Prompt -Object " $user" -ForegroundColor $sl.Colors.PromptHighlightColor 17 | # write at (devicename) 18 | $computer = $sl.CurrentHostname 19 | $prompt += Write-Prompt -Object " at" -ForegroundColor $sl.Colors.PromptForegroundColor 20 | $prompt += Write-Prompt -Object " $computer" -ForegroundColor $sl.Colors.GitDefaultColor 21 | # write in for folder 22 | $prompt += Write-Prompt -Object " in" -ForegroundColor $sl.Colors.PromptForegroundColor 23 | } 24 | # write folder 25 | $dir = Get-FullPath -dir $pwd 26 | $prompt += Write-Prompt -Object " $dir " -ForegroundColor $sl.Colors.AdminIconForegroundColor 27 | # write on (git:branchname status) 28 | $status = Get-VCSStatus 29 | if ($status) { 30 | $sl.GitSymbols.BranchSymbol = '' 31 | $themeInfo = Get-VcsInfo -status ($status) 32 | $prompt += Write-Prompt -Object 'on git:' -ForegroundColor $sl.Colors.PromptForegroundColor 33 | $prompt += Write-Prompt -Object "$($themeInfo.VcInfo) " -ForegroundColor $themeInfo.BackgroundColor 34 | } 35 | # write virtualenv 36 | if (Test-VirtualEnv) { 37 | $prompt += Write-Prompt -Object 'inside env:' -ForegroundColor $sl.Colors.PromptForegroundColor 38 | $prompt += Write-Prompt -Object "$(Get-VirtualEnvName) " -ForegroundColor $themeInfo.VirtualEnvForegroundColor 39 | } 40 | # write [time] 41 | $timeStamp = Get-Date -Format T 42 | $prompt += Write-Prompt "[$timeStamp]" -ForegroundColor $sl.Colors.PromptForegroundColor 43 | # check for elevated prompt 44 | If (Test-Administrator) { 45 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor 46 | } 47 | # check the last command state and indicate if failed 48 | $foregroundColor = $sl.Colors.PromptHighlightColor 49 | If ($lastCommandFailed) { 50 | $foregroundColor = $sl.Colors.CommandFailedIconForegroundColor 51 | } 52 | 53 | if ($with) { 54 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 55 | } 56 | 57 | $prompt += Set-Newline 58 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $foregroundColor 59 | $prompt += ' ' 60 | $prompt 61 | } 62 | 63 | function Get-TimeSinceLastCommit { 64 | return (git log --pretty=format:'%cr' -1) 65 | } 66 | 67 | $sl = $global:ThemeSettings #local settings 68 | $sl.PromptSymbols.StartSymbol = '#' 69 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x279C) 70 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 71 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 72 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 73 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 74 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 75 | $sl.Colors.VirtualEnvForegroundColor = [ConsoleColor]::Red 76 | -------------------------------------------------------------------------------- /Themes/Lambda.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | #check the last command state and indicate if failed 12 | If ($lastCommandFailed) { 13 | $prompt = Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 14 | } 15 | 16 | #check for elevated prompt 17 | If (Test-Administrator) { 18 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor 19 | } 20 | 21 | $user = $sl.CurrentUser 22 | $lambda = [char]::ConvertFromUtf32(0x000003BB) 23 | if (Test-NotDefaultUser($user)) { 24 | $prompt += Write-Prompt -Object "$lambda " -ForegroundColor $sl.Colors.PromptForegroundColor 25 | } 26 | 27 | # Writes the drive portion 28 | $prompt += Write-Prompt -Object "$(Get-ShortPath -dir $pwd) " -ForegroundColor $sl.Colors.DriveForegroundColor 29 | 30 | $status = Get-VCSStatus 31 | if ($status) { 32 | $themeInfo = Get-VcsInfo -status ($status) 33 | $prompt += Write-Prompt -Object "git:" -ForegroundColor $sl.Colors.PromptForegroundColor 34 | $prompt += Write-Prompt -Object "$($themeInfo.VcInfo) " -ForegroundColor $themeInfo.BackgroundColor 35 | } 36 | 37 | # write virtualenv 38 | if (Test-VirtualEnv) { 39 | $prompt += Write-Prompt -Object 'env:' -ForegroundColor $sl.Colors.PromptForegroundColor 40 | $prompt += Write-Prompt -Object "$(Get-VirtualEnvName) " -ForegroundColor $themeInfo.VirtualEnvForegroundColor 41 | } 42 | 43 | if ($with) { 44 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 45 | } 46 | 47 | $prompt 48 | } 49 | 50 | $sl = $global:ThemeSettings #local settings 51 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 52 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 53 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 54 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkRed 55 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 56 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed 57 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::DarkRed -------------------------------------------------------------------------------- /Themes/Material.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | #$prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator+" ") -ForegroundColor $sl.Colors.PromptBackgroundColor 11 | #check the last command state and indicate if failed 12 | $promtSymbolColor = [ConsoleColor]::Green 13 | If ($lastCommandFailed) { 14 | $promtSymbolColor = [ConsoleColor]::Red 15 | } 16 | 17 | $prompt += Write-Prompt -Object ( 18 | [char]::ConvertFromUtf32(0x276F)) -ForegroundColor $sl.Colors.GitNoLocalChangesAndAheadColor 19 | $prompt += Write-Prompt -Object ( 20 | [char]::ConvertFromUtf32(0x276F)+" ") -ForegroundColor $promtSymbolColor 21 | # Writes the postfixes to the prompt 22 | 23 | 24 | $user = $sl.CurrentUser 25 | $prompt += Write-Prompt -Object $user 26 | $prompt += Write-Prompt -Object " :: " 27 | # Writes the drive portion 28 | $drive = $sl.PromptSymbols.HomeSymbol 29 | if ($pwd.Path -ne $HOME) { 30 | $drive = "$(Split-Path -path $pwd -Leaf)" 31 | } 32 | $prompt += Write-Prompt -Object $drive -ForegroundColor $sl.Colors.DriveForegroundColor 33 | 34 | $status = Get-VCSStatus 35 | if ($status) { 36 | $prompt += Write-Prompt -Object " git(" -ForegroundColor $sl.Colors.PromptHighlightColor 37 | $prompt += Write-Prompt -Object ($status.Branch) -ForegroundColor $sl.Colors.WithForegroundColor 38 | $prompt += Write-Prompt -Object ")" -ForegroundColor $sl.Colors.PromptHighlightColor 39 | if ($status.Working.Length -gt 0) { 40 | $prompt += Write-Prompt -Object (" "+$sl.PromptSymbols.GitDirtyIndicator) -ForegroundColor $sl.Colors.GitDefaultColor 41 | } 42 | } else { 43 | $prompt += Write-Prompt -Object (" ::") -ForegroundColor $sl.Colors.GitDefaultColor 44 | } 45 | 46 | if ($with) { 47 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 48 | } 49 | $sTime = " $(Get-Date -Format HH:mm)" 50 | $prompt += Write-Prompt -Object $sTime -ForegroundColor $sl.colors.PromptSymbolColor 51 | #$prompt += Set-Newline 52 | 53 | $prompt += ' ' 54 | $prompt 55 | } 56 | 57 | function Get-TimeSinceLastCommit { 58 | return (git log --pretty=format:'%cr' -1) 59 | } 60 | 61 | $sl = $global:ThemeSettings #local settings 62 | $sl.PromptSymbols.PromptIndicator = '+' 63 | $sl.PromptSymbols.HomeSymbol = '🏠' 64 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 65 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Blue 66 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 67 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 68 | $sl.PromptSymbols.GitDirtyIndicator =[char]::ConvertFromUtf32(10007) 69 | $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow 70 | $sl.Colors.AdminIconForegroundColor = [ConsoleColor]::Blue 71 | -------------------------------------------------------------------------------- /Themes/Operator.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | $lastColor = $sl.Colors.PromptBackgroundColor 12 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 13 | 14 | $prompt += Set-Newline 15 | 16 | #check the last command state and indicate if failed 17 | If ($lastCommandFailed) { 18 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 19 | } 20 | 21 | #check for elevated prompt 22 | If (Test-Administrator) { 23 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 24 | } 25 | 26 | $user = $sl.CurrentUser 27 | $computer = $sl.CurrentHostname 28 | $pathSymbol = if ($pwd.Path -eq $HOME) { $sl.PromptSymbols.PathHomeSymbol } else { $sl.PromptSymbols.PathSymbol } 29 | $path = $pathSymbol + " " + (Get-FullPath -dir $pwd) 30 | 31 | if (Test-VirtualEnv) { 32 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 33 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 34 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.VirtualEnvBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 35 | } 36 | else { 37 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 38 | } 39 | 40 | # Writes the drive portion 41 | $prompt += Write-Prompt -Object "$path " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 42 | 43 | $status = Get-VCSStatus 44 | if ($status) { 45 | $themeInfo = Get-VcsInfo -status ($status) 46 | $lastColor = $themeInfo.BackgroundColor 47 | $prompt += Write-Prompt -Object $($sl.PromptSymbols.SegmentForwardSymbol) -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $lastColor 48 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -BackgroundColor $lastColor -ForegroundColor $sl.Colors.GitForegroundColor 49 | } 50 | 51 | # Writes the postfix to the prompt 52 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor 53 | 54 | $timeStamp = Get-Date -Format "hh:mm tt" 55 | $timestamp = " $timeStamp " 56 | 57 | if ($host.UI.RawUI.CursorPosition.X + $timestamp.Length + 9 -lt $host.UI.RawUI.WindowSize.Width){ 58 | $prompt += Set-CursorForRightBlockWrite -textLength ($timestamp.Length + 9) 59 | $prompt += Write-Prompt -Object $sl.PromptSymbols.Blur1Symbol -ForegroundColor $PromptForegroundColor 60 | $prompt += Write-Prompt -Object $sl.PromptSymbols.Blur2Symbol -ForegroundColor $PromptForegroundColor 61 | $prompt += Write-Prompt -Object $sl.PromptSymbols.Blur3Symbol -ForegroundColor $PromptForegroundColor 62 | $prompt += Write-Prompt $timeStamp -ForegroundColor $sl.Colors.GitForegroundColor -BackgroundColor $sl.Colors.PromptForegroundColor 63 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ClockSymbol) " -ForegroundColor $sl.Colors.GitForegroundColor -BackgroundColor $sl.Colors.PromptForegroundColor 64 | $prompt += Write-Prompt -Object $sl.PromptSymbols.Blur3Symbol -ForegroundColor $PromptForegroundColor 65 | $prompt += Write-Prompt -Object $sl.PromptSymbols.Blur2Symbol -ForegroundColor $PromptForegroundColor 66 | $prompt += Write-Prompt -Object $sl.PromptSymbols.Blur1Symbol -ForegroundColor $PromptForegroundColor 67 | } 68 | $prompt += Set-Newline 69 | 70 | 71 | if (Test-NotDefaultUser($user)) { 72 | $prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor 73 | } 74 | if ($with) { 75 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 76 | } 77 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator) -ForegroundColor $sl.Colors.PromptSymbolColor 78 | $prompt += ' ' 79 | $prompt 80 | } 81 | 82 | $sl = $global:ThemeSettings #local settings 83 | $sl.PromptSymbols.StartSymbol = '' 84 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 85 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 86 | $sl.PromptSymbols.Blur1Symbol = [char]::ConvertFromUtf32(0x2591) 87 | $sl.PromptSymbols.Blur2Symbol = [char]::ConvertFromUtf32(0x2592) 88 | $sl.PromptSymbols.Blur3Symbol = [char]::ConvertFromUtf32(0x2593) 89 | $sl.PromptSymbols.ClockSymbol = [char]::ConvertFromUtf32(0xf64f) 90 | $sl.PromptSymbols.PathHomeSymbol = [char]::ConvertFromUtf32(0xf015) 91 | $sl.PromptSymbols.PathSymbol = [char]::ConvertFromUtf32(0xf07c) 92 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 93 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 94 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 95 | $sl.Colors.GitForegroundColor = [ConsoleColor]::Black 96 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 97 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 98 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red 99 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 100 | -------------------------------------------------------------------------------- /Themes/Paradox.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | $lastColor = $sl.Colors.PromptBackgroundColor 12 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 13 | 14 | #check the last command state and indicate if failed 15 | If ($lastCommandFailed) { 16 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 17 | } 18 | 19 | #check for elevated prompt 20 | If (Test-Administrator) { 21 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 22 | } 23 | 24 | $user = $sl.CurrentUser 25 | $computer = $sl.CurrentHostname 26 | $path = Get-FullPath -dir $pwd 27 | if (Test-NotDefaultUser($user)) { 28 | $prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 29 | } 30 | 31 | if (Test-VirtualEnv) { 32 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 33 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 34 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.VirtualEnvBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 35 | } 36 | else { 37 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 38 | } 39 | 40 | # Writes the drive portion 41 | $prompt += Write-Prompt -Object "$path " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 42 | 43 | $status = Get-VCSStatus 44 | if ($status) { 45 | $themeInfo = Get-VcsInfo -status ($status) 46 | $lastColor = $themeInfo.BackgroundColor 47 | $prompt += Write-Prompt -Object $($sl.PromptSymbols.SegmentForwardSymbol) -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $lastColor 48 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -BackgroundColor $lastColor -ForegroundColor $sl.Colors.GitForegroundColor 49 | } 50 | 51 | # Writes the postfix to the prompt 52 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor 53 | 54 | $timeStamp = Get-Date -UFormat %R 55 | $timestamp = "[$timeStamp]" 56 | 57 | $prompt += Set-CursorForRightBlockWrite -textLength ($timestamp.Length + 1) 58 | $prompt += Write-Prompt $timeStamp -ForegroundColor $sl.Colors.PromptForegroundColor 59 | 60 | $prompt += Set-Newline 61 | 62 | if ($with) { 63 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 64 | } 65 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator) -ForegroundColor $sl.Colors.PromptSymbolColor 66 | $prompt += ' ' 67 | $prompt 68 | } 69 | 70 | $sl = $global:ThemeSettings #local settings 71 | $sl.PromptSymbols.StartSymbol = '' 72 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 73 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 74 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 75 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 76 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 77 | $sl.Colors.GitForegroundColor = [ConsoleColor]::Black 78 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 79 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 80 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red 81 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 82 | -------------------------------------------------------------------------------- /Themes/Pararussel.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | #check the last command state and indicate if failed and change the colors of the arrows 12 | If ($lastCommandFailed) { 13 | $prompt += Write-Prompt -Object ( 14 | [char]::ConvertFromUtf32(0x276F)) -ForegroundColor $sl.Colors.WithForegroundColor 15 | $prompt += Write-Prompt -Object ( 16 | [char]::ConvertFromUtf32(0x276F) +" ") -ForegroundColor $sl.Colors.WithForegroundColor 17 | }Else{ 18 | $prompt += Write-Prompt -Object ( 19 | [char]::ConvertFromUtf32(0x276F)) -ForegroundColor $sl.Colors.GitNoLocalChangesAndAheadColor 20 | $prompt += Write-Prompt -Object ( 21 | [char]::ConvertFromUtf32(0x276F) +" ") -ForegroundColor $sl.Colors.PromptSymbolColor 22 | } 23 | 24 | 25 | # Writes the drive portion 26 | $drive = $sl.PromptSymbols.HomeSymbol 27 | if ($pwd.Path -ne $HOME) { 28 | $drive = "$(Split-Path -path $pwd -Leaf)" 29 | } 30 | $prompt += Write-Prompt -Object $drive -ForegroundColor $sl.Colors.DriveForegroundColor 31 | 32 | $status = Get-VCSStatus 33 | if ($status) { 34 | $prompt += Write-Prompt -Object " git:(" -ForegroundColor $sl.Colors.PromptHighlightColor 35 | $prompt += Write-Prompt -Object "$($status.Branch)" -ForegroundColor $sl.Colors.WithForegroundColor 36 | $prompt += Write-Prompt -Object ")" -ForegroundColor $sl.Colors.PromptHighlightColor 37 | if ($status.Working.Length -gt 0) { 38 | $prompt += Write-Prompt -Object (" " + $sl.PromptSymbols.GitDirtyIndicator) -ForegroundColor $sl.Colors.GitDefaultColor 39 | } 40 | } 41 | 42 | if ($with) { 43 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 44 | } 45 | 46 | $timeStamp = Get-Date -UFormat %R 47 | $clock = [char]::ConvertFromUtf32(0x25F7) 48 | $timestamp = "$clock $timeStamp" 49 | 50 | if ($status) { 51 | $timeStamp = Get-TimeSinceLastCommit 52 | } 53 | $prompt += Set-CursorForRightBlockWrite -textLength $timestamp.Length 54 | $prompt += Write-Prompt $timeStamp -ForegroundColor $sl.Colors.DriveForegroundColor 55 | $prompt += Set-Newline 56 | 57 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator) -ForegroundColor $sl.Colors.PromptBackgroundColor 58 | 59 | $prompt += ' ' 60 | $prompt 61 | } 62 | 63 | function Get-TimeSinceLastCommit { 64 | return (git log --pretty=format:'%cr' -1) 65 | } 66 | 67 | $sl = $global:ThemeSettings #local settings 68 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x1F441) 69 | $sl.PromptSymbols.HomeSymbol = [char]::ConvertFromUtf32(0x1F3E0) 70 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 71 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Blue 72 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 73 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 74 | $sl.PromptSymbols.GitDirtyIndicator = [char]::ConvertFromUtf32(0x1F4CC) 75 | $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow 76 | -------------------------------------------------------------------------------- /Themes/PowerLine.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | 5 | param( 6 | [bool] 7 | $lastCommandFailed, 8 | [string] 9 | $with 10 | ) 11 | 12 | $lastColor = $sl.Colors.PromptBackgroundColor 13 | 14 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 15 | 16 | #check the last command state and indicate if failed 17 | If ($lastCommandFailed) { 18 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 19 | } 20 | 21 | #check for elevated prompt 22 | If (Test-Administrator) { 23 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 24 | } 25 | 26 | $user = $sl.CurrentUser 27 | $computer = [System.Environment]::MachineName 28 | if (Test-NotDefaultUser($user)) { 29 | $prompt += Write-Prompt -Object "$user@$computer " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 30 | } 31 | 32 | if (Test-VirtualEnv) { 33 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 34 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 35 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.VirtualEnvBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 36 | } 37 | else { 38 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 39 | } 40 | 41 | # Writes the drive portion 42 | $path = (Get-FullPath -dir $pwd).Replace('\', ' ' + [char]::ConvertFromUtf32(0xE0B1) + ' ') + ' ' 43 | $prompt += Write-Prompt -Object $path -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 44 | 45 | $status = Get-VCSStatus 46 | if ($status) { 47 | $themeInfo = Get-VcsInfo -status ($status) 48 | $lastColor = $themeInfo.BackgroundColor 49 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $lastColor 50 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -BackgroundColor $lastColor -ForegroundColor $sl.Colors.GitForegroundColor 51 | } 52 | 53 | if ($with) { 54 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor -BackgroundColor $sl.Colors.WithBackgroundColor 55 | $prompt += Write-Prompt -Object " $($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 56 | $lastColor = $sl.Colors.WithBackgroundColor 57 | } 58 | 59 | # Writes the postfix to the prompt 60 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor 61 | $prompt += ' ' 62 | $prompt 63 | } 64 | 65 | $sl = $global:ThemeSettings #local settings 66 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 67 | $sl.Colors.SessionInfoBackgroundColor = [ConsoleColor]::DarkGray 68 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 69 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 70 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 71 | $sl.Colors.GitForegroundColor = [ConsoleColor]::DarkGray 72 | $sl.Colors.WithForegroundColor = [ConsoleColor]::White 73 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed 74 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red 75 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 76 | -------------------------------------------------------------------------------- /Themes/Powerlevel10k-Classic.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | $adminsymbol = $sl.PromptSymbols.ElevatedSymbol 11 | $venvsymbol = $sl.PromptSymbols.VirtualEnvSymbol 12 | $clocksymbol = $sl.PromptSymbols.ClockSymbol 13 | 14 | ## Left Part 15 | $prompt = Write-Prompt -Object " $($sl.PromptSymbols.StartSymbol) " -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 16 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentSubForwardSymbol) " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 17 | $pathSymbol = if ($pwd.Path -eq $HOME) { $sl.PromptSymbols.PathHomeSymbol } else { $sl.PromptSymbols.PathSymbol } 18 | 19 | # Writes the drive portion 20 | $path = $pathSymbol + " " + (Get-FullPath -dir $pwd) + " " 21 | $prompt += Write-Prompt -Object $path -ForegroundColor $sl.Colors.DriveForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 22 | 23 | $status = Get-VCSStatus 24 | if ($status) { 25 | $themeInfo = Get-VcsInfo -status ($status) 26 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentSubForwardSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 27 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -ForegroundColor $themeInfo.BackgroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 28 | } 29 | If ($with) { 30 | $sWith = " $($with.ToUpper())" 31 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentSubForwardSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 32 | $prompt += Write-Prompt -Object $sWith -ForegroundColor $sl.Colors.WithForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 33 | } 34 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.SessionInfoBackgroundColor 35 | ### 36 | 37 | ## Right Part 38 | $rightElements = New-Object 'System.Collections.Generic.List[Tuple[string,ConsoleColor]]' 39 | $login = $sl.CurrentUser 40 | $computer = [System.Environment]::MachineName; 41 | 42 | $rightElements.Add([System.Tuple]::Create($sl.PromptSymbols.SegmentBackwardSymbol, $sl.Colors.SessionInfoBackgroundColor)) 43 | # List of all right elements 44 | if (Test-VirtualEnv) { 45 | $rightElements.Add([System.Tuple]::Create(" $(Get-VirtualEnvName) $venvsymbol ", $sl.Colors.VirtualEnvForegroundColor)) 46 | $rightElements.Add([System.Tuple]::Create($sl.PromptSymbols.SegmentSubBackwardSymbol, $sl.Colors.PromptForegroundColor)) 47 | } 48 | if (Test-Administrator) { 49 | $rightElements.Add([System.Tuple]::Create(" $adminsymbol", $sl.Colors.AdminIconForegroundColor)) 50 | } 51 | $rightElements.Add([System.Tuple]::Create(" $login@$computer ", $sl.Colors.UserForegroundColor)) 52 | $rightElements.Add([System.Tuple]::Create($sl.PromptSymbols.SegmentSubBackwardSymbol, $sl.Colors.PromptForegroundColor)) 53 | $rightElements.Add([System.Tuple]::Create(" $(Get-Date -Format HH:mm:ss) $clocksymbol ", $sl.Colors.TimestampForegroundColor)) 54 | $lengthList = [Linq.Enumerable]::Select($rightElements, [Func[Tuple[string, ConsoleColor], int]] { $args[0].Item1.Length }) 55 | $total = [Linq.Enumerable]::Sum($lengthList) 56 | # Transform into total length 57 | $prompt += Set-CursorForRightBlockWrite -textLength $total 58 | # The line head needs special care and is always drawn 59 | $prompt += Write-Prompt -Object $rightElements[0].Item1 -ForegroundColor $sl.Colors.SessionInfoBackgroundColor 60 | for ($i = 1; $i -lt $rightElements.Count; $i++) { 61 | $prompt += Write-Prompt -Object $rightElements[$i].Item1 -ForegroundColor $rightElements[$i].Item2 -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 62 | } 63 | ### 64 | 65 | $prompt += Write-Prompt -Object "`r" 66 | $prompt += Set-Newline 67 | 68 | # Writes the postfixes to the prompt 69 | $indicatorColor = If ($lastCommandFailed) { $sl.Colors.CommandFailedIconForegroundColor } Else { $sl.Colors.PromptSymbolColor } 70 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $indicatorColor 71 | $prompt += ' ' 72 | $prompt 73 | } 74 | 75 | $sl = $global:ThemeSettings #local settings 76 | $sl.PromptSymbols.StartSymbol = [char]::ConvertFromUtf32(0xe62a) 77 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 78 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 79 | $sl.PromptSymbols.SegmentSubForwardSymbol = [char]::ConvertFromUtf32(0xE0B1) 80 | $sl.PromptSymbols.SegmentBackwardSymbol = [char]::ConvertFromUtf32(0xE0B2) 81 | $sl.PromptSymbols.SegmentSubBackwardSymbol = [char]::ConvertFromUtf32(0xE0B3) 82 | $sl.PromptSymbols.ClockSymbol = [char]::ConvertFromUtf32(0xf64f) 83 | $sl.PromptSymbols.PathHomeSymbol = [char]::ConvertFromUtf32(0xf015) 84 | $sl.PromptSymbols.PathSymbol = [char]::ConvertFromUtf32(0xf07c) 85 | $sl.Colors.PromptBackgroundColor = [ConsoleColor]::DarkGray 86 | $sl.Colors.SessionInfoBackgroundColor = [ConsoleColor]::DarkGray 87 | $sl.Colors.VirtualEnvBackgroundColor = [ConsoleColor]::DarkGray 88 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 89 | $sl.Colors.CommandFailedIconForegroundColor = [ConsoleColor]::DarkRed 90 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 91 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::Gray 92 | $sl.Colors.SessionInfoForegroundColor = [ConsoleColor]::White 93 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 94 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::Magenta 95 | $sl.Colors.TimestampForegroundColor = [ConsoleColor]::Green 96 | $sl.Colors.UserForegroundColor = [ConsoleColor]::Yellow 97 | $sl.Colors.GitForegroundColor = [ConsoleColor]::White # Just in case... -------------------------------------------------------------------------------- /Themes/Powerlevel10k-Lean.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | # path 12 | $sPath = "$(Get-FullPath -dir $pwd) " 13 | 14 | # check for elevated prompt 15 | $sAdmin = "" 16 | If (Test-Administrator) { 17 | $sAdmin = " $($sl.PromptSymbols.ElevatedSymbol)" 18 | } 19 | 20 | # git info 21 | $sVcs = "" 22 | #$vcsInfo = $sl.Colors.DriveForegroundColor 23 | If ($vcsStatus = Get-VCSStatus) { 24 | $vcsInfo = Get-VcsInfo -status ($vcsStatus) 25 | $sVcs = "$($vcsInfo.VcInfo) " 26 | } 27 | 28 | # timestamp 29 | $sTime = " $(Get-Date -Format HH:mm:ss)" 30 | 31 | # check the last command state and indicate if failed 32 | $sFailed = "" 33 | If ($lastCommandFailed) { 34 | $sFailed = " $($sl.PromptSymbols.FailedCommandSymbol)" 35 | } 36 | 37 | # virtualenv 38 | $sVenv = "" 39 | If (Test-VirtualEnv) { 40 | $sVenv = " $(Get-VirtualEnvName)" 41 | } 42 | 43 | # with 44 | $sWith = "" 45 | If ($with) { 46 | $sWith = " $($with.ToUpper())" 47 | } 48 | 49 | $rightPrompt = "$sFailed$sWith$sVenv$sAdmin$sTime" 50 | $prompt += Set-CursorForRightBlockWrite -textLength $rightPrompt.Length 51 | 52 | $prompt += Write-Prompt -Object $sFailed -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 53 | $prompt += Write-Prompt -Object $sWith -ForegroundColor $sl.Colors.WithForegroundColor 54 | $prompt += Write-Prompt -Object $sVenv -ForegroundColor $sl.Colors.VirtualEnvForegroundColor 55 | $prompt += Write-Prompt -Object $sAdmin -ForegroundColor $sl.Colors.AdminIconForegroundColor 56 | $prompt += Write-Prompt -Object $sTime -ForegroundColor $sl.colors.TimestampForegroundColor 57 | $prompt += Write-Prompt -Object "`r" 58 | $prompt += Write-Prompt -Object $sPath -ForegroundColor $sl.Colors.DriveForegroundColor 59 | $prompt += Write-Prompt -Object $sVcs -ForegroundColor $vcsInfo.BackgroundColor 60 | 61 | If ($sl.DoubleCommandLine) { 62 | $prompt += Set-Newline 63 | } 64 | 65 | # Writes the postfixes to the prompt 66 | $indicatorColor = If ($lastCommandFailed) { $sl.Colors.CommandFailedIconForegroundColor } Else { $sl.Colors.PromptSymbolColor } 67 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $indicatorColor 68 | $prompt += ' ' 69 | $prompt 70 | } 71 | 72 | $sl = $global:ThemeSettings #local settings 73 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 74 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 75 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 76 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 77 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 78 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::Magenta 79 | $sl.Colors.TimestampForegroundColor = [ConsoleColor]::DarkCyan 80 | $sl | Add-Member -NotePropertyName DoubleCommandLine -NotePropertyValue 0 -Force 81 | -------------------------------------------------------------------------------- /Themes/Powerlevel9k.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | $adminsymbol = $sl.PromptSymbols.ElevatedSymbol 11 | $venvsymbol = $sl.PromptSymbols.VirtualEnvSymbol 12 | 13 | $lastColor = $sl.Colors.SessionInfoBackgroundColor 14 | $login = $sl.CurrentUser 15 | $computer = (Get-Culture).TextInfo.ToTitleCase([System.Environment]::MachineName.ToLower()); 16 | if ($IsLinux) { $iconhex = 0xf17c } 17 | elseif ($IsMacOS) { $iconhex = 0xf302 } 18 | else { $iconhex = 0xe70f } 19 | 20 | ## Left Part 21 | $prompt = Write-Prompt -Object "╔═" -ForegroundColor $sl.Colors.PromptSymbolColor 22 | $prompt += Write-Prompt -Object " $([char]::ConvertFromUtf32($iconhex))" -ForegroundColor $sl.Colors.StartForegroundColor 23 | $prompt += Write-Prompt -Object " $($sl.PromptSymbols.SegmentSubForwardSymbol)" -ForegroundColor $sl.Colors.UserForegroundColor 24 | $prompt += Write-Prompt -Object " $login@$computer " -ForegroundColor $sl.Colors.UserForegroundColor 25 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.PromptSymbolColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 26 | $pathSymbol = if ($pwd.Path -eq $HOME) { $sl.PromptSymbols.PathHomeSymbol } else { $sl.PromptSymbols.PathSymbol } 27 | 28 | # Writes the drive portion 29 | $path = $pathSymbol + " " + (Get-ShortPath -dir $pwd) + " " 30 | $prompt += Write-Prompt -Object $path -ForegroundColor $sl.Colors.DriveForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 31 | 32 | $status = Get-VCSStatus 33 | if ($status) { 34 | $themeInfo = Get-VcsInfo -status ($status) 35 | $lastColor = $themeInfo.BackgroundColor 36 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $themeInfo.BackgroundColor 37 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $themeInfo.BackgroundColor 38 | } 39 | If ($with) { 40 | $sWith = " $($with.ToUpper())" 41 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentSubForwardSymbol -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 42 | $prompt += Write-Prompt -Object $sWith -ForegroundColor $sl.Colors.WithForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 43 | } 44 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor 45 | ### 46 | 47 | ## Right Part 48 | $rightElements = New-Object 'System.Collections.Generic.List[Tuple[string,ConsoleColor]]' 49 | 50 | $rightElements.Add([System.Tuple]::Create($sl.PromptSymbols.SegmentBackwardSymbol, $sl.Colors.StatsInfoBackgroundColor)) 51 | # List of all right elements 52 | if (Test-VirtualEnv) { 53 | $rightElements.Add([System.Tuple]::Create(" $(Get-VirtualEnvName) $venvsymbol ", $sl.Colors.VirtualEnvForegroundColor)) 54 | $rightElements.Add([System.Tuple]::Create($sl.PromptSymbols.SegmentSubBackwardSymbol, $sl.Colors.PromptForegroundColor)) 55 | } 56 | if (Test-Administrator) { 57 | $rightElements.Add([System.Tuple]::Create(" $adminsymbol", $sl.Colors.AdminIconForegroundColor)) 58 | } 59 | 60 | $battery = Get-BatteryInfo 61 | if ($battery) { 62 | $rightElements.Add([System.Tuple]::Create(" $battery ", $sl.Colors.PromptForegroundColor)) 63 | $rightElements.Add([System.Tuple]::Create($sl.PromptSymbols.SegmentSubBackwardSymbol, $sl.Colors.PromptForegroundColor)) 64 | } 65 | 66 | # Update the clock icon based on time 67 | [int]$hour = Get-Date -UFormat %I 68 | switch ($hour) { 69 | 1 { $clockhex = 0xe382 } 70 | 2 { $clockhex = 0xe383 } 71 | 3 { $clockhex = 0xe384 } 72 | 4 { $clockhex = 0xe385 } 73 | 5 { $clockhex = 0xe386 } 74 | 6 { $clockhex = 0xe387 } 75 | 7 { $clockhex = 0xe388 } 76 | 8 { $clockhex = 0xe389 } 77 | 9 { $clockhex = 0xe38a } 78 | 10 { $clockhex = 0xe38b } 79 | 11 { $clockhex = 0xe38c } 80 | Default { $clockhex = 0xe381 } 81 | } 82 | $clocksymbol = [char]::ConvertFromUtf32($clockhex) 83 | $rightElements.Add([System.Tuple]::Create(" $(Get-Date -Format HH:mm:ss) $clocksymbol ", $sl.Colors.PromptForegroundColor)) 84 | 85 | $lengthList = [Linq.Enumerable]::Select($rightElements, [Func[Tuple[string, ConsoleColor], int]] { $args[0].Item1.Length }) 86 | $total = [Linq.Enumerable]::Sum($lengthList) 87 | # Transform into total length 88 | $prompt += Set-CursorForRightBlockWrite -textLength $total 89 | # The line head needs special care and is always drawn 90 | $prompt += Write-Prompt -Object $rightElements[0].Item1 -ForegroundColor $sl.Colors.StatsInfoBackgroundColor 91 | for ($i = 1; $i -lt $rightElements.Count; $i++) { 92 | $prompt += Write-Prompt -Object $rightElements[$i].Item1 -ForegroundColor $rightElements[$i].Item2 -BackgroundColor $sl.Colors.StatsInfoBackgroundColor 93 | } 94 | ### 95 | 96 | $prompt += Write-Prompt -Object "`r" 97 | $prompt += Set-Newline 98 | 99 | # Writes the postfixes to the prompt 100 | $indicatorColor = If ($lastCommandFailed) { $sl.Colors.CommandFailedIconForegroundColor } Else { $sl.Colors.PromptSymbolColor } 101 | $prompt += Write-Prompt -Object "╚═" -ForegroundColor $indicatorColor 102 | $prompt += ' ' 103 | $prompt 104 | } 105 | 106 | $sl = $global:ThemeSettings #local settings 107 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 108 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 109 | $sl.PromptSymbols.SegmentSubForwardSymbol = [char]::ConvertFromUtf32(0xE0B1) 110 | $sl.PromptSymbols.SegmentBackwardSymbol = [char]::ConvertFromUtf32(0xE0B2) 111 | $sl.PromptSymbols.SegmentSubBackwardSymbol = [char]::ConvertFromUtf32(0xE0B3) 112 | $sl.PromptSymbols.PathHomeSymbol = [char]::ConvertFromUtf32(0xf015) 113 | $sl.PromptSymbols.PathSymbol = [char]::ConvertFromUtf32(0xf07c) 114 | $sl.Colors.PromptBackgroundColor = [ConsoleColor]::DarkGray 115 | $sl.Colors.SessionInfoBackgroundColor = [ConsoleColor]::DarkBlue 116 | $sl.Colors.StatsInfoBackgroundColor = [ConsoleColor]::Black 117 | $sl.Colors.VirtualEnvBackgroundColor = [ConsoleColor]::DarkGray 118 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Blue 119 | $sl.Colors.CommandFailedIconForegroundColor = [ConsoleColor]::DarkRed 120 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 121 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 122 | $sl.Colors.SessionInfoForegroundColor = [ConsoleColor]::White 123 | $sl.Colors.StartForegroundColor = [ConsoleColor]::Blue 124 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 125 | $sl.Colors.VirtualEnvForegroundColor = [ConsoleColor]::Magenta 126 | $sl.Colors.UserForegroundColor = [ConsoleColor]::White 127 | -------------------------------------------------------------------------------- /Themes/PowerlinePlus.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | 5 | param( 6 | [bool] 7 | $lastCommandFailed, 8 | [string] 9 | $with 10 | ) 11 | 12 | $lastColor = $sl.Colors.PromptBackgroundColor 13 | 14 | $authorityStatus = ((Invoke-CimMethod -InputObject $(Get-CimInstance Win32_Process -Filter "Handle=$PID") -MethodName GetOwner).User) -eq 'SYSTEM' 15 | 16 | # identify background colors for administrative rights 17 | # declare the colors 18 | $rootBackground = [ConsoleColor]::Magenta 19 | $rootForeground = [ConsoleColor]::White 20 | $reguserBackground = [ConsoleColor]::Blue 21 | $reguserForeground = [ConsoleColor]::White 22 | $authorityForeground = [ConsoleColor]::White 23 | $authorityBackground = [ConsoleColor]::Red 24 | # make it work 25 | If ($authorityStatus) { 26 | $promptTagBackground = $authorityBackground 27 | $promptTagForeground = $authorityForeground 28 | } 29 | else { 30 | If (Test-Administrator) { 31 | $promptTagBackground = $rootBackground 32 | $rootForeground = $rootForeground 33 | } 34 | else { 35 | $promptTagBackground = $reguserBackground 36 | $promptTagForeground = $reguserForeground 37 | } 38 | } 39 | 40 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 41 | 42 | $user = $sl.CurrentUser 43 | $computer = [System.Environment]::MachineName 44 | if ($authorityStatus) { 45 | $prompt += Write-Prompt -Object "$computer" -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 46 | } 47 | else { 48 | if (Test-NotDefaultUser($user)) { 49 | $prompt += Write-Prompt -Object "$user@$computer" -ForegroundColor $sl.Colors.SessionInfoForegroundColor -BackgroundColor $sl.Colors.SessionInfoBackgroundColor 50 | } 51 | } 52 | 53 | if (Test-VirtualEnv) { 54 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 55 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.VirtualEnvSymbol) $(Get-VirtualEnvName) " -ForegroundColor $sl.Colors.VirtualEnvForegroundColor -BackgroundColor $sl.Colors.VirtualEnvBackgroundColor 56 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.VirtualEnvBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 57 | } 58 | else { 59 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $sl.Colors.SessionInfoBackgroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 60 | } 61 | 62 | # Writes the drive portion 63 | $path = (Get-ShortPath -dir $pwd).Replace('\', ' ' + [char]::ConvertFromUtf32(0xE0B1) + ' ') + ' ' 64 | $prompt += Write-Prompt -Object $path -ForegroundColor $sl.Colors.PromptForegroundColor -BackgroundColor $sl.Colors.PromptBackgroundColor 65 | $status = Get-VCSStatus 66 | if ($status) { 67 | $themeInfo = Get-VcsInfo -status ($status) 68 | $lastColor = $themeInfo.BackgroundColor 69 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $sl.Colors.PromptBackgroundColor -BackgroundColor $lastColor 70 | $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -BackgroundColor $lastColor -ForegroundColor $sl.Colors.GitForegroundColor 71 | } 72 | 73 | if ($with) { 74 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $lastColor -BackgroundColor $sl.Colors.WithBackgroundColor 75 | $prompt += Write-Prompt -Object " $($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 76 | $lastColor = $sl.Colors.WithBackgroundColor 77 | } 78 | 79 | If ($lastCommandFailed) { 80 | $errsign = "ERROR".Replace('\', ' ' + [char]::ConvertFromUtf32(0xE0B1) + ' ') + ' ' 81 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $lastColor -BackgroundColor $errBackground 82 | $prompt += Write-Prompt -Object $errsign -ForegroundColor $errForeground -BackgroundColor $errBackground 83 | $lastColor = $errBackground 84 | $promptTagBackgroundStatusErrCheck = $errBackground 85 | } 86 | else { 87 | $promptTagBackgroundStatusErrCheck = $promptTagBackground 88 | } 89 | If ($authorityStatus) { 90 | $authoritysign = "@".Replace('\', ' ' + [char]::ConvertFromUtf32(0xE0B1) + ' ') + ' ' 91 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $lastColor -BackgroundColor $promptTagBackgroundStatusErrCheck 92 | $prompt += Write-Prompt -Object $authoritysign -ForegroundColor $promptTagForeground -BackgroundColor $promptTagBackgroundStatusErrCheck 93 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $promptTagBackgroundStatusErrCheck -BackgroundColor $sl.Colors.SessionInfoForegroundColor 94 | } 95 | else { 96 | If (Test-Administrator) { 97 | $rootsign = "#".Replace('\', ' ' + [char]::ConvertFromUtf32(0xE0B1) + ' ') + ' ' 98 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $lastColor -BackgroundColor $promptTagBackgroundStatusErrCheck 99 | $prompt += Write-Prompt -Object $rootsign -ForegroundColor $promptTagForeground -BackgroundColor $promptTagBackgroundStatusErrCheck 100 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $promptTagBackgroundStatusErrCheck -BackgroundColor $sl.Colors.SessionInfoForegroundColor 101 | } 102 | else { 103 | $norootsign = "$".Replace('\', ' ' + [char]::ConvertFromUtf32(0xE0B1) + ' ') + ' ' 104 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.SegmentForwardSymbol) " -ForegroundColor $lastColor -BackgroundColor $promptTagBackgroundStatusErrCheck 105 | $prompt += Write-Prompt -Object $norootsign -ForegroundColor $promptTagForeground -BackgroundColor $promptTagBackgroundStatusErrCheck 106 | $prompt += Write-Prompt -Object $sl.PromptSymbols.SegmentForwardSymbol -ForegroundColor $promptTagBackgroundStatusErrCheck -BackgroundColor $sl.Colors.SessionInfoForegroundColor 107 | } 108 | } 109 | # Writes the postfix to the prompt 110 | $prompt += ' ' 111 | $prompt 112 | } 113 | 114 | $sl = $global:ThemeSettings #local settings 115 | $sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 116 | $sl.Colors.SessionInfoBackgroundColor = [ConsoleColor]::Cyan 117 | $sl.Colors.SessionInfoForegroundColor = [ConsoleColor]::Black 118 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 119 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 120 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 121 | $sl.Colors.GitForegroundColor = [ConsoleColor]::Black 122 | $sl.Colors.WithForegroundColor = [ConsoleColor]::White 123 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::DarkRed 124 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red 125 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White 126 | $errForeground = [ConsoleColor]::White 127 | $errBackground = [ConsoleColor]::DarkRed 128 | -------------------------------------------------------------------------------- /Themes/Punk.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | #check the last command state and indicate if failed 12 | If ($lastCommandFailed) { 13 | $prompt = Write-Prompt -Object "Don't Panic!" -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 14 | } 15 | 16 | $prompt += Set-Newline 17 | 18 | #check for elevated prompt 19 | If (Test-Administrator) { 20 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor 21 | } 22 | 23 | $status = Get-VCSStatus 24 | if ($status) { 25 | $prompt += Write-Prompt -Object "$($status.Branch)$([char]::ConvertFromUtf32(0xE0A0)) " -ForegroundColor $themeInfo.BackgroundColor 26 | } 27 | 28 | # write virtualenv 29 | if (Test-VirtualEnv) { 30 | $prompt += Write-Prompt -Object "$(Get-VirtualEnvName)" -ForegroundColor $themeInfo.VirtualEnvForegroundColor 31 | } 32 | 33 | # Writes the drive portion 34 | $prompt += Write-Prompt -Object " $(Get-FullPath -dir $pwd)" -ForegroundColor $sl.Colors.DriveForegroundColor 35 | 36 | # Writes the postfixes to the prompt 37 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.DriveForegroundColor 38 | $prompt += ' ' 39 | $prompt 40 | } 41 | 42 | $sl = $global:ThemeSettings #local settings 43 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 44 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 45 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 46 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 47 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 48 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 49 | -------------------------------------------------------------------------------- /Themes/Sorin.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | #check the last command state and indicate if failed 12 | If ($lastCommandFailed) { 13 | $prompt = Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 14 | } 15 | 16 | #check for elevated prompt 17 | If (Test-Administrator) { 18 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor 19 | } 20 | 21 | $user = $sl.CurrentUser 22 | if (Test-NotDefaultUser($user)) { 23 | $prompt += Write-Prompt -Object "$user " -ForegroundColor $sl.Colors.PromptForegroundColor 24 | } 25 | 26 | # Writes the drive portion 27 | $prompt += Write-Prompt -Object "$(Get-ShortPath -dir $pwd) " -ForegroundColor $sl.Colors.DriveForegroundColor 28 | 29 | $status = Get-VCSStatus 30 | if ($status) { 31 | $themeInfo = Get-VcsInfo -status ($status) 32 | $prompt += Write-Prompt -Object "git:" -ForegroundColor $sl.Colors.PromptForegroundColor 33 | $prompt += Write-Prompt -Object "$($themeInfo.VcInfo) " -ForegroundColor $themeInfo.BackgroundColor 34 | } 35 | 36 | # write virtualenv 37 | if (Test-VirtualEnv) { 38 | $prompt += Write-Prompt -Object 'env:' -ForegroundColor $sl.Colors.PromptForegroundColor 39 | $prompt += Write-Prompt -Object "$(Get-VirtualEnvName) " -ForegroundColor $themeInfo.VirtualEnvForegroundColor 40 | } 41 | 42 | if ($with) { 43 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 44 | } 45 | 46 | # Writes the postfixes to the prompt 47 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 48 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.AdminIconForegroundColor 49 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.GitNoLocalChangesAndAheadColor 50 | $prompt += ' ' 51 | $prompt 52 | } 53 | 54 | $sl = $global:ThemeSettings #local settings 55 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) 56 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::White 57 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 58 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue 59 | $sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed 60 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 61 | -------------------------------------------------------------------------------- /Themes/Star.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | 12 | #check the last command state and indicate if failed and change the colors of the arrows 13 | $dir = Get-FullPath -dir $pwd 14 | If ($lastCommandFailed) { 15 | $prompt += Write-Prompt -Object $dir -ForegroundColor $sl.Colors.WithForegroundColor 16 | }else{ 17 | $prompt += Write-Prompt -Object $dir -ForegroundColor $sl.Colors.DriveForegroundColor 18 | } 19 | 20 | # Writes the drive portion 21 | 22 | 23 | $status = Get-VCSStatus 24 | if ($status) { 25 | $themeInfo = Get-VcsInfo -status ($status) 26 | $info = "$($themeInfo.VcInfo)".Split(" ")[1].TrimStart() 27 | $prompt += Write-Prompt -Object " on " -ForegroundColor $sl.Colors.PromptForegroundColor 28 | $prompt += Write-Prompt -Object "$($sl.GitSymbols.BranchSymbol+' ')" -ForegroundColor $sl.Colors.GitDefaultColor 29 | $prompt += Write-Prompt -Object "$($status.Branch)" -ForegroundColor $sl.Colors.GitDefaultColor 30 | $prompt += Write-Prompt -Object " [$($info)]" -ForegroundColor $sl.Colors.PromptHighlightColor 31 | $filename = 'package.json' 32 | if (Test-Path -path $filename) { 33 | $prompt += Write-Prompt -Object (" via node") -ForegroundColor $sl.Colors.PromptSymbolColor 34 | } 35 | } 36 | 37 | if ($with) { 38 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 39 | } 40 | 41 | $prompt+= Set-Newline 42 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator) -ForegroundColor $sl.Colors.PromptSymbolColor 43 | $prompt += ' ' 44 | $prompt 45 | } 46 | 47 | 48 | $sl = $global:ThemeSettings #local settings 49 | $sl.GitSymbols.BranchSymbol = [char]::ConvertFromUtf32(0xE0A0) 50 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x279C) 51 | $sl.PromptSymbols.HomeSymbol = '~' 52 | $sl.PromptSymbols.GitDirtyIndicator =[char]::ConvertFromUtf32(10007) 53 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 54 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Blue 55 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 56 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 57 | $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow -------------------------------------------------------------------------------- /Themes/Zash.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | $user=$sl.CurrentUser 12 | $prompt+= Write-Prompt -Object ('@'+$user) -ForegroundColor $sl.Colors.WithForegroundColor 13 | #check the last command state and indicate if failed and change the colors of the arrows 14 | If ($lastCommandFailed) { 15 | $prompt += Write-Prompt -Object (' '+$sl.PromptSymbols.PromptIndicator+' ') -ForegroundColor $sl.Colors.WithForegroundColor 16 | }else{ 17 | $prompt += Write-Prompt -Object (' '+$sl.PromptSymbols.PromptIndicator+' ') -ForegroundColor $sl.Colors.PromptSymbolColor 18 | } 19 | 20 | 21 | # Writes the drive portion 22 | $drive = $sl.PromptSymbols.HomeSymbol 23 | if ($pwd.Path -ne $HOME) { 24 | $drive = "$(Split-Path -path $pwd -Leaf)" 25 | } 26 | $prompt += Write-Prompt -Object $drive -ForegroundColor $sl.Colors.DriveForegroundColor 27 | 28 | $status = Get-VCSStatus 29 | if ($status) { 30 | $prompt += Write-Prompt -Object " git(" -ForegroundColor $sl.Colors.PromptHighlightColor 31 | $prompt += Write-Prompt -Object "$($status.Branch)" -ForegroundColor $sl.Colors.GitDefaultColor 32 | $prompt += Write-Prompt -Object ")" -ForegroundColor $sl.Colors.PromptHighlightColor 33 | if ($status.Working.Length -gt 0) { 34 | $prompt += Write-Prompt -Object (" " + $sl.PromptSymbols.GitDirtyIndicator) -ForegroundColor $sl.Colors.PromptSymbolColor 35 | } 36 | } 37 | 38 | if ($with) { 39 | $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor 40 | } 41 | 42 | 43 | 44 | $prompt += ' ' 45 | $prompt 46 | } 47 | 48 | 49 | $sl = $global:ThemeSettings #local settings 50 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x279C) 51 | $sl.PromptSymbols.HomeSymbol = '~' 52 | $sl.PromptSymbols.GitDirtyIndicator =[char]::ConvertFromUtf32(10007) 53 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 54 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Blue 55 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 56 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 57 | $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow 58 | -------------------------------------------------------------------------------- /Themes/cypher.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme 4 | { 5 | param( 6 | [bool] 7 | $lastCommandFailed, 8 | [string] 9 | $with 10 | ) 11 | 12 | $user = $sl.CurrentUser 13 | $prompt = Write-Prompt -Object ("$user ") -ForegroundColor $sl.Colors.UsernameForegroundColor 14 | $prompt += Write-Prompt -Object (":: ") -ForegroundColor $sl.Colors.SeparatorForegroundColor 15 | 16 | $drive = $sl.PromptSymbols.HomeSymbol 17 | if ($pwd.Path -ne $HOME) { 18 | $drive = "$(Split-Path -path $pwd -Leaf)" 19 | } 20 | $prompt += Write-Prompt -Object ($drive + " ") -ForegroundColor $sl.Colors.DriveForegroundColor 21 | 22 | $prompt += Write-Prompt -Object $sl.PromptSymbols.PromptIndicator -ForegroundColor $sl.Colors.PromptForegroundColor 23 | $prompt += ' ' 24 | $prompt 25 | } 26 | 27 | $sl = $global:ThemeSettings 28 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x00BB) 29 | $sl.Colors.UsernameForegroundColor = [ConsoleColor]::Blue 30 | $sl.Colors.SeparatorForegroundColor = [ConsoleColor]::Red 31 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Green 32 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::Magenta -------------------------------------------------------------------------------- /Themes/pure.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | #check the last command state and indicate if failed 12 | $promtSymbolColor = $sl.Colors.PromptSymbolColor 13 | If ($lastCommandFailed) { 14 | $promtSymbolColor = $sl.Colors.WithForegroundColor 15 | } 16 | 17 | # Writes the drive portion 18 | $drive = Get-FullPath -dir $pwd 19 | $prompt += Write-Prompt -Object $drive -ForegroundColor $sl.Colors.DriveForegroundColor 20 | 21 | $prompt += Write-Prompt -Object ' ' 22 | 23 | $status = Get-VCSStatus 24 | if ($status) { 25 | $prompt += Write-Prompt -Object "$($status.Branch)" -ForegroundColor $sl.Colors.WithForegroundColor 26 | if ($status.Working.Length -gt 0) { 27 | $prompt += Write-Prompt -Object (" " + $sl.PromptSymbols.GitDirtyIndicator) -ForegroundColor $sl.Colors.GitDefaultColor 28 | } 29 | } 30 | 31 | # New line 32 | $prompt += Set-Newline 33 | 34 | # Writes the postfixes to the prompt 35 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator) -ForegroundColor $promtSymbolColor 36 | 37 | $prompt += ' ' 38 | $prompt 39 | } 40 | 41 | $sl = $global:ThemeSettings #local settings 42 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276f) 43 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 44 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Blue 45 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 46 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 47 | $sl.PromptSymbols.GitDirtyIndicator = [char]::ConvertFromUtf32(10007) 48 | $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow 49 | -------------------------------------------------------------------------------- /Themes/qwerty.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | 5 | param( 6 | [bool] 7 | $lastCommandFailed, 8 | [string] 9 | $with 10 | ) 11 | 12 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptForegroundColor 13 | 14 | #check for elevated prompt 15 | If (Test-Administrator) { 16 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor 17 | } 18 | 19 | $drive = $sl.PromptSymbols.HomeSymbol 20 | if ($pwd.Path -ne $HOME) { 21 | $drive = "$(Split-Path -path $pwd -Leaf)" 22 | } 23 | $prompt += Write-Prompt -Object $drive -ForegroundColor $sl.Colors.PromptForegroundColor 24 | 25 | $status = Get-VCSStatus 26 | if ($status) { 27 | $themeInfo = Get-VcsInfo -status ($status) 28 | $lastColor = $themeInfo.BackgroundColor 29 | $prompt += Write-Prompt -Object " ::" -ForegroundColor $sl.Colors.AccentColor 30 | $prompt += Write-Prompt -Object " $($status.Branch)" -ForegroundColor $lastColor 31 | } 32 | 33 | 34 | 35 | #check the last command state and indicate if failed 36 | If ($lastCommandFailed) { 37 | $prompt += Write-Prompt -Object " $($sl.PromptSymbols.FailedCommandSymbol)" -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 38 | } 39 | 40 | if (Test-VirtualEnv) { 41 | $prompt += Write-Prompt -Object " $($sl.PromptSymbols.VirtualEnvSymbol)" -ForegroundColor $sl.Colors.AccentColor 42 | $prompt += Write-Prompt -Object " $(Get-VirtualEnvName)" -ForegroundColor $sl.Colors.VirtualEnvForegroundColor 43 | } 44 | if ($with) { 45 | $prompt += Write-Prompt -Object " *" -ForegroundColor $sl.Colors.AccentColor 46 | $prompt += Write-Prompt -Object " $($with.ToUpper())" -ForegroundColor $sl.Colors.WithForegroundColor 47 | } 48 | 49 | $prompt += Write-Prompt -Object (" " + $sl.PromptSymbols.PromptIndicator) -ForegroundColor $sl.Colors.AccentColor 50 | $prompt += ' ' 51 | $prompt 52 | } 53 | 54 | $sl = $global:ThemeSettings #local settings 55 | $sl.PromptSymbols.StartSymbol = '' 56 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276f) 57 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::Cyan 58 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 59 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Cyan 60 | $sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta 61 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::White 62 | $sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Magenta 63 | $sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::Magenta 64 | $sl.Colors.AccentColor = [System.ConsoleColor]::DarkGray 65 | 66 | -------------------------------------------------------------------------------- /Themes/robbyrussell.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | #check the last command state and indicate if failed 12 | $promtSymbolColor = $sl.Colors.PromptSymbolColor 13 | If ($lastCommandFailed) { 14 | $promtSymbolColor = $sl.Colors.WithForegroundColor 15 | } 16 | 17 | #check the python virtual environment 18 | If (Test-VirtualEnv) { 19 | $prompt += Write-Prompt -Object ("(" + $(Get-VirtualEnvName) + ") ") 20 | } 21 | 22 | # Writes the postfixes to the prompt 23 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator + " ") -ForegroundColor $promtSymbolColor 24 | 25 | # Writes the drive portion 26 | $drive = $sl.PromptSymbols.HomeSymbol 27 | if ($pwd.Path -ne $HOME) { 28 | $drive = "$(Split-Path -path $pwd -Leaf)" 29 | } 30 | $prompt += Write-Prompt -Object $drive -ForegroundColor $sl.Colors.DriveForegroundColor 31 | 32 | $status = Get-VCSStatus 33 | if ($status) { 34 | $prompt += Write-Prompt -Object " git:(" -ForegroundColor $sl.Colors.PromptHighlightColor 35 | $prompt += Write-Prompt -Object "$($status.Branch)" -ForegroundColor $sl.Colors.WithForegroundColor 36 | $prompt += Write-Prompt -Object ")" -ForegroundColor $sl.Colors.PromptHighlightColor 37 | if ($status.Working.Length -gt 0) { 38 | $prompt += Write-Prompt -Object (" " + $sl.PromptSymbols.GitDirtyIndicator) -ForegroundColor $sl.Colors.GitDefaultColor 39 | } 40 | } 41 | 42 | $prompt += ' ' 43 | $prompt 44 | } 45 | 46 | $sl = $global:ThemeSettings #local settings 47 | $sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x279C) 48 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Green 49 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Blue 50 | $sl.Colors.DriveForegroundColor = [ConsoleColor]::Cyan 51 | $sl.Colors.WithForegroundColor = [ConsoleColor]::Red 52 | $sl.PromptSymbols.GitDirtyIndicator = [char]::ConvertFromUtf32(10007) 53 | $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow 54 | -------------------------------------------------------------------------------- /Themes/tehrob.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | 11 | $user = $s1.CurrentUser 12 | $prompt = Write-Prompt -Object "$user " -ForegroundColor $s1.Colors.PromptForegroundColor 13 | $prompt += Write-Prompt -Object ":: " -ForegroundColor $s1.Colors.AdminIconForegroundColor 14 | $prompt += Write-Prompt -Object "$(Get-FullPath -dir $pwd) " -ForegroundColor $s1.Colors.DriveForegroundColor 15 | 16 | $status = Get-VCSStatus 17 | if ($status) { 18 | $gitbranchpre = [char]::ConvertFromUtf32(0x003c) 19 | $gitbranchpost = [char]::ConvertFromUtf32(0x003e) 20 | 21 | $gitinfo = get-vcsinfo -status $status 22 | $prompt += Write-Prompt -Object "$gitbranchpre$($gitinfo.vcinfo)$gitbranchpost " -ForegroundColor $($gitinfo.backgroundcolor) 23 | } 24 | 25 | $prompt += Write-Prompt -Object $s1.PromptSymbols.PromptIndicator -ForegroundColor $s1.Colors.AdminIconForegroundColor 26 | $prompt += ' ' 27 | $prompt 28 | } 29 | 30 | $s1 = $global:ThemeSettings 31 | $s1.GitSymbols.BranchIdenticalStatusToSymbol = "" 32 | $s1.GitSymbols.BranchSymbol = "" 33 | $s1.GitSymbols.BranchUntrackedSymbol = "*" 34 | $s1.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x00BB) 35 | 36 | # Colors 37 | $s1.Colors.PromptForegroundColor = [ConsoleColor]::White 38 | $s1.Colors.AdminIconForegroundColor = [ConsoleColor]::Blue 39 | $s1.Colors.DriveForegroundColor = [ConsoleColor]::Green 40 | -------------------------------------------------------------------------------- /Themes/ys.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | function Write-Theme { 4 | param( 5 | [bool] 6 | $lastCommandFailed, 7 | [string] 8 | $with 9 | ) 10 | # check the last command state and indicate if failed 11 | If ($lastCommandFailed) { 12 | $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor 13 | } 14 | # write # and space 15 | $prompt = Write-Prompt -Object $sl.PromptSymbols.StartSymbol -ForegroundColor $sl.Colors.PromptSymbolColor 16 | # write user and host 17 | $user = $sl.CurrentUser 18 | if (Test-NotDefaultUser($user)) { 19 | $prompt += Write-Prompt -Object " $user" -ForegroundColor $sl.Colors.PromptHighlightColor 20 | # write at (devicename) 21 | $computer = $sl.CurrentHostname 22 | $prompt += Write-Prompt -Object " at" -ForegroundColor $foregroundColor 23 | $prompt += Write-Prompt -Object " $computer" -ForegroundColor $sl.Colors.PromptForegroundColor 24 | # write in for folder 25 | $prompt += Write-Prompt -Object " in" -ForegroundColor $foregroundColor 26 | } 27 | # write folder 28 | $dir = Get-FullPath -dir $pwd 29 | $prompt += Write-Prompt -Object " $dir " -ForegroundColor $sl.Colors.GitDefaultColor 30 | # write on (git:branchname status) 31 | $status = Get-VCSStatus 32 | if ($status) { 33 | $themeInfo = Get-VcsInfo -status ($status) 34 | $prompt += Write-Prompt -Object 'on git:' -ForegroundColor $foregroundColor 35 | $prompt += Write-Prompt -Object "$($themeInfo.VcInfo) " -ForegroundColor $sl.Colors.GitForegroundColor 36 | } 37 | # write [time] 38 | $timeStamp = Get-Date -Format T 39 | $prompt += Write-Prompt "[$timeStamp]" -ForegroundColor $foregroundColor 40 | # new line 41 | $prompt += Set-Newline 42 | if (Test-Administrator) { 43 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.ElevatedSymbol + " ") -ForegroundColor $sl.Colors.AdminIconForegroundColor 44 | } 45 | else{ 46 | $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator + " ") -ForegroundColor $sl.Colors.PromptSymbolColor 47 | } 48 | } 49 | 50 | $sl = $global:ThemeSettings # local settings 51 | $sl.PromptSymbols.StartSymbol = '#' 52 | $sl.PromptSymbols.PromptIndicator = '%' 53 | $sl.PromptSymbols.ElevatedSymbol = '$' 54 | $sl.GitSymbols.BranchSymbol = '' 55 | $sl.GitSymbols.BranchUntrackedSymbol = 'x' 56 | $sl.GitSymbols.BranchIdenticalStatusToSymbol = 'o' 57 | $sl.PromptSymbols.FailedCommandSymbol = '?' 58 | 59 | # for dark theme 60 | $sl.Colors.AdminIconForegroundColor = [ConsoleColor]::Red 61 | $sl.Colors.PromptSymbolColor = [ConsoleColor]::Blue 62 | $sl.Colors.PromptForegroundColor = [ConsoleColor]::Green 63 | $sl.Colors.PromptHighlightColor = [ConsoleColor]::Cyan 64 | $sl.Colors.GitDefaultColor = [ConsoleColor]::Yellow 65 | $sl.Colors.GitForegroundColor = [ConsoleColor]::Cyan 66 | 67 | # inspired by ys theme: not to use special characters (powerline fonts). 68 | # >[https://blog.ysmood.org/my-ys-terminal-theme/]() 69 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | skip_tags: true 2 | skip_commits: 3 | files: 4 | - .github/* 5 | - README.md 6 | environment: 7 | GH_KEY: 8 | secure: 7CipYchiaJLIPf5MRNnJ2+Nk7dm+FxWkEHlASCcskJbMz+jbdz/qiseUeKCkQKHC 9 | NG_KEY: 10 | secure: tN2AWqN8DMHjaUvl6AbwwMK1GrF6K0xPiCSGRh1SWZGex4kgVAx+Rri1AxxPYmBg 11 | CA_KEY: 12 | secure: 3kVQxECrq007jkGdai1dUpk35w+YigWkfk5C5aXi2lAX0zU+oOI1SYkGo2o6NbIp 13 | version: 2.0.{build} 14 | image: 15 | - Visual Studio 2019 16 | - Ubuntu 17 | build_script: 18 | - pwsh: (Get-Content '.\oh-my-posh.psd1' -Raw).Replace('1.0.0.0', $ENV:APPVEYOR_BUILD_VERSION) | Out-File -Encoding 'UTF8' '.\oh-my-posh.psd1' 19 | before_test: 20 | - pwsh: .\Build\setup_test_env.ps1 21 | test_script: 22 | - pwsh: >- 23 | if ($isWindows) { 24 | .\Build\test_windows.ps1 25 | } 26 | else { 27 | Invoke-Pester 28 | } 29 | deploy_script: 30 | - pwsh: >- 31 | if ($isWindows) { 32 | .\Build\release.ps1 33 | } 34 | -------------------------------------------------------------------------------- /defaults.ps1: -------------------------------------------------------------------------------- 1 | # Oh-My-Posh default settings 2 | function Get-ThemesLocation { 3 | $folderName = "PoshThemes" 4 | if ($PROFILE) { 5 | return (Join-Path (Split-Path -Parent $PROFILE) $folderName) 6 | } 7 | return "~\${$folderName}" 8 | } 9 | 10 | $global:ThemeSettings = New-Object -TypeName PSObject -Property @{ 11 | CurrentUser = [System.Environment]::UserName 12 | CurrentHostname = [System.Environment]::MachineName 13 | CurrentThemeLocation = "$PSScriptRoot\Themes\Agnoster.psm1" 14 | MyThemesLocation = Get-ThemesLocation 15 | ErrorCount = 0 16 | GitSymbols = @{ 17 | BranchSymbol = [char]::ConvertFromUtf32(0xE0A0) 18 | BeforeStashSymbol = '{' 19 | BeforeIndexSymbol = '' 20 | BeforeWorkingSymbol = '' 21 | AfterStashSymbol = '}' 22 | DelimSymbol = '|' 23 | LocalWorkingStatusSymbol = '!' 24 | LocalStagedStatusSymbol = '~' 25 | LocalDefaultStatusSymbol = '' 26 | BranchUntrackedSymbol = [char]::ConvertFromUtf32(0x2262) 27 | BranchIdenticalStatusToSymbol = [char]::ConvertFromUtf32(0x2263) 28 | BranchAheadStatusSymbol = [char]::ConvertFromUtf32(0x2191) 29 | BranchBehindStatusSymbol = [char]::ConvertFromUtf32(0x2193) 30 | OriginSymbols = @{ 31 | Github = [char]::ConvertFromUtf32(0xF09B) 32 | Bitbucket = [char]::ConvertFromUtf32(0xF171) 33 | GitLab = [char]::ConvertFromUtf32(0xF296) 34 | } 35 | } 36 | PromptSymbols = @{ 37 | StartSymbol = ' ' 38 | TruncatedFolderSymbol = '..' 39 | PromptIndicator = [char]::ConvertFromUtf32(0x25B6) 40 | FailedCommandSymbol = [char]::ConvertFromUtf32(0x2A2F) 41 | ElevatedSymbol = [char]::ConvertFromUtf32(0x26A1) 42 | SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) 43 | SegmentBackwardSymbol = [char]::ConvertFromUtf32(0x26A1) 44 | SegmentSeparatorForwardSymbol = [char]::ConvertFromUtf32(0x26A1) 45 | SegmentSeparatorBackwardSymbol = [char]::ConvertFromUtf32(0x26A1) 46 | PathSeparator = [System.IO.Path]::DirectorySeparatorChar 47 | VirtualEnvSymbol = [char]::ConvertFromUtf32(0xE606) 48 | HomeSymbol = '~' 49 | RootSymbol = '#' 50 | UNCSymbol = '§' 51 | } 52 | Colors = @{ 53 | GitDefaultColor = [ConsoleColor]::DarkGreen 54 | GitLocalChangesColor = [ConsoleColor]::DarkYellow 55 | GitNoLocalChangesAndAheadColor = [ConsoleColor]::DarkMagenta 56 | GitNoLocalChangesAndBehindColor = [ConsoleColor]::DarkRed 57 | GitNoLocalChangesAndAheadAndBehindColor = [ConsoleColor]::DarkRed 58 | PromptForegroundColor = [ConsoleColor]::White 59 | PromptHighlightColor = [ConsoleColor]::DarkBlue 60 | DriveForegroundColor = [ConsoleColor]::DarkBlue 61 | PromptBackgroundColor = [ConsoleColor]::DarkBlue 62 | PromptSymbolColor = [ConsoleColor]::White 63 | SessionInfoBackgroundColor = [ConsoleColor]::Black 64 | SessionInfoForegroundColor = [ConsoleColor]::White 65 | CommandFailedIconForegroundColor = [ConsoleColor]::DarkRed 66 | AdminIconForegroundColor = [ConsoleColor]::DarkYellow 67 | WithBackgroundColor = [ConsoleColor]::DarkRed 68 | WithForegroundColor = [ConsoleColor]::White 69 | GitForegroundColor = [ConsoleColor]::Black 70 | VirtualEnvForegroundColor = [ConsoleColor]::White 71 | VirtualEnvBackgroundColor = [ConsoleColor]::Red 72 | } 73 | Options = @{ 74 | ConsoleTitle = $true 75 | OriginSymbols = $false 76 | PreserveLastExitCode = $true 77 | } 78 | } 79 | 80 | # PSColor default settings 81 | $global:PSColor = @{ 82 | File = @{ 83 | Default = @{ Color = 'White' } 84 | Directory = @{ Color = 'DarkBlue' } 85 | Hidden = @{ Color = 'Gray'; Pattern = '^\.' } 86 | Code = @{ Color = 'Magenta'; Pattern = '\.(java|c|cpp|cs|js|css|html)$' } 87 | Executable = @{ Color = 'Red'; Pattern = '\.(exe|bat|cmd|py|pl|ps1|psm1|vbs|rb|reg)$' } 88 | Text = @{ Color = 'White'; Pattern = '\.(txt|cfg|conf|ini|csv|log|config|xml|yml|md|markdown)$' } 89 | Compressed = @{ Color = 'DarkGreen'; Pattern = '\.(zip|tar|gz|rar|jar|war)$' } 90 | } 91 | Service = @{ 92 | Default = @{ Color = 'White' } 93 | Running = @{ Color = 'DarkGreen' } 94 | Stopped = @{ Color = 'DarkYellow' } 95 | } 96 | Match = @{ 97 | Default = @{ Color = 'White' } 98 | Path = @{ Color = 'Cyan' } 99 | LineNumber = @{ Color = 'DarkGreen' } 100 | Line = @{ Color = 'White' } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /img/agnoster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/agnoster.png -------------------------------------------------------------------------------- /img/avit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/avit.png -------------------------------------------------------------------------------- /img/darkblood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/darkblood.png -------------------------------------------------------------------------------- /img/emodipt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/emodipt.png -------------------------------------------------------------------------------- /img/fish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/fish.png -------------------------------------------------------------------------------- /img/honukai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/honukai.png -------------------------------------------------------------------------------- /img/indications.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/indications.png -------------------------------------------------------------------------------- /img/lambda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/lambda.png -------------------------------------------------------------------------------- /img/material.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/material.png -------------------------------------------------------------------------------- /img/material2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/material2.png -------------------------------------------------------------------------------- /img/operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/operator.png -------------------------------------------------------------------------------- /img/paradox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/paradox.png -------------------------------------------------------------------------------- /img/pararussel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/pararussel.png -------------------------------------------------------------------------------- /img/robbyrussel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/robbyrussel.png -------------------------------------------------------------------------------- /img/showcolors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/showcolors.png -------------------------------------------------------------------------------- /img/sorin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/sorin.png -------------------------------------------------------------------------------- /img/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/star.png -------------------------------------------------------------------------------- /img/themecolors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/themecolors.png -------------------------------------------------------------------------------- /img/themesettings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/themesettings.png -------------------------------------------------------------------------------- /img/zash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh2/c4919171881e8384a0af4aa5dec26d3ad0ea5f88/img/zash.png -------------------------------------------------------------------------------- /oh-my-posh.psd1: -------------------------------------------------------------------------------- 1 | # 2 | # Module manifest for module 'oh-my-posh' 3 | # 4 | # Generated by: Jan 5 | # 6 | # Generated on: 28-Jun-16 7 | # 8 | 9 | @{ 10 | 11 | # Version number of this module. 12 | ModuleVersion = '1.0.0.0' 13 | 14 | # Script module or binary module file associated with this manifest. 15 | RootModule = 'oh-my-posh.psm1' 16 | 17 | # ID used to uniquely identify this module 18 | GUID = '7d7c4a78-e2fe-4e5f-9510-34ac893e4562' 19 | 20 | # Company or vendor of this module 21 | CompanyName = 'Unknown' 22 | 23 | # Author of this module 24 | Author = 'Jan De Dobbeleer' 25 | 26 | # Copyright statement for this module 27 | Copyright = '(c) 2018 Jan De Dobbeleer. All rights reserved.' 28 | 29 | # Description of the functionality provided by this module 30 | Description = 'Theming capabilities for the PowerShell prompt in ConEmu' 31 | 32 | # Minimum version of the Windows PowerShell engine required by this module 33 | PowerShellVersion = '5.0' 34 | 35 | # List of all files packaged with this module 36 | FileList = @('defaults.ps1', 'Themes/Agnoster.psm1', 'Themes/Avit.psm1', 'Themes/Darkblood.psm1', 'Themes/Fish.psm1', 'Themes/Honukai.psm1', 'Themes/Paradox.psm1', 'Themes/Sorin.psm1', 'Helpers/PoshGit.ps1', 'Helpers/Prompt.ps1') 37 | 38 | # Cmdlets to export from this module 39 | CmdletsToExport = @() 40 | 41 | # Variables to export from this module 42 | VariablesToExport = @() 43 | 44 | # Aliases to export from this module 45 | AliasesToExport = '*' 46 | 47 | # Functions to export from this module 48 | FunctionsToExport = @('Write-ColorPreview', 49 | 'Show-Colors', 50 | 'Show-ThemeColors', 51 | 'Show-ThemeSymbols', 52 | 'Get-Theme', 53 | 'Set-Theme', 54 | 'Get-VCSStatus', 55 | 'Get-VcsInfo', 56 | 'Get-FormattedRootLocation', 57 | 'Get-ShortPath', 58 | 'Get-FullPath', 59 | 'Set-CursorForRightBlockWrite', 60 | 'Set-CursorUp', 61 | 'Test-VirtualEnv', 62 | 'Get-VirtualEnvName', 63 | 'Test-NotDefaultUser', 64 | 'Test-Administrator', 65 | 'Get-ComputerName', 66 | 'Set-Newline', 67 | 'Get-BatteryInfo', 68 | 'Get-ThemesLocation' 69 | 'Set-Prompt') 70 | 71 | # Private data to pass to the module specified in RootModule. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 72 | PrivateData = @{ 73 | 74 | PSData = @{ 75 | 76 | # Tags applied to this module. These help with module discovery in online galleries. 77 | Tags = @('git', 'agnoster', 'theme', 'zsh', 'posh-git', 'prompt', 'paradox') 78 | 79 | # A URL to the license for this module. 80 | LicenseUri = 'https://github.com/JanDeDobbeleer/oh-my-posh2/blob/master/LICENSE' 81 | 82 | # A URL to the main website for this project. 83 | ProjectUri = 'https://github.com/JanDeDobbeleer/oh-my-posh2' 84 | 85 | } # End of PSData hashtable 86 | 87 | } # End of PrivateData hashtable 88 | 89 | } 90 | -------------------------------------------------------------------------------- /oh-my-posh.psm1: -------------------------------------------------------------------------------- 1 | #requires -Version 2 -Modules posh-git 2 | 3 | . "$PSScriptRoot\defaults.ps1" 4 | . "$PSScriptRoot\Helpers\PoshGit.ps1" 5 | . "$PSScriptRoot\Helpers\Prompt.ps1" 6 | 7 | <# 8 | .SYNOPSIS 9 | Generates the prompt before each line in the console 10 | #> 11 | function Set-Prompt { 12 | Import-Module $sl.CurrentThemeLocation -Force 13 | 14 | [ScriptBlock]$Prompt = { 15 | $realLASTEXITCODE = $global:LASTEXITCODE 16 | $lastCommandFailed = ($global:error.Count -gt $sl.ErrorCount) -or -not $? 17 | $sl.ErrorCount = $global:error.Count 18 | 19 | #Start the vanilla posh-git when in a vanilla window, else: go nuts 20 | if(Test-IsVanillaWindow) { 21 | Write-Host -Object ($pwd.ProviderPath) -NoNewline 22 | Write-VcsStatus 23 | } 24 | 25 | Reset-CursorPosition 26 | $prompt = (Write-Theme -lastCommandFailed $lastCommandFailed) 27 | 28 | if($sl.Options.ConsoleTitle) { 29 | $location = Get-Location 30 | $folder = $location.Path 31 | $folderSplit = $folder -split "$([IO.Path]::DirectorySeparatorChar)", 0, "SimpleMatch" 32 | if ($folderSplit.length -gt 3) 33 | { 34 | $folder = "$($folderSplit[0])", "...", "$($folderSplit[-2])", "$($folderSplit[-1])" -join "$([IO.Path]::DirectorySeparatorChar)" 35 | } 36 | $prompt += "$([char]27)]2;$($folder)$([char]7)" 37 | if ($location.Provider.Name -eq "FileSystem") { 38 | $prompt += "$([char]27)]9;9;`"$($location.Path)`"$([char]7)" 39 | } 40 | } 41 | 42 | $prompt 43 | if ($sl.Options.PreserveLastExitCode) { 44 | $global:LASTEXITCODE = $realLASTEXITCODE 45 | } 46 | Remove-Variable realLASTEXITCODE -Confirm:$false 47 | } 48 | 49 | Set-Item -Path Function:prompt -Value $Prompt -Force 50 | } 51 | 52 | function global:Write-WithPrompt() { 53 | param( 54 | [string] 55 | $command 56 | ) 57 | 58 | $lastCommandFailed = $global:error.Count -gt $sl.ErrorCount 59 | $sl.ErrorCount = $global:error.Count 60 | 61 | if(Test-IsVanillaWindow) { 62 | Write-ClassicPrompt -command $command 63 | return 64 | } 65 | 66 | Write-Theme -lastCommandFailed $lastCommandFailed -with $command 67 | } 68 | 69 | function Show-ThemeColors { 70 | ############################## 71 | #.SYNOPSIS 72 | # Show Current Theme Colors 73 | # 74 | #.DESCRIPTION 75 | # Good for checking if your current color mappings 76 | # work well with the theme. 77 | # 78 | ############################## 79 | Write-Host -Object '' 80 | $sl.Colors.Keys | Sort-Object | ForEach-Object { Write-ColorPreview -text $_ -color $sl.Colors[$_] } 81 | Write-Host -Object '' 82 | } 83 | 84 | function Show-ThemeSymbols { 85 | ############################## 86 | #.SYNOPSIS 87 | # Show Current Theme Symbols 88 | # 89 | #.DESCRIPTION 90 | # Good for checking if your current font supports 91 | # all the symbols the theme uses. 92 | # 93 | ############################## 94 | Write-Host -Object "`n--PromptSymbols--`n" 95 | $sl.PromptSymbols.Keys | Sort-Object | ForEach-Object { Write-Host -Object ("{0,3} {1}" -f $sl.PromptSymbols[$_], $_) } 96 | Write-Host -Object '' 97 | Write-Host -Object "`n--GitSymbols--`n" 98 | $sl.GitSymbols.Keys | Sort-Object | ForEach-Object { Write-Host -Object ("{0,3} {1}" -f $sl.GitSymbols[$_], $_) } 99 | Write-Host -Object '' 100 | } 101 | 102 | function Write-ColorPreview { 103 | param 104 | ( 105 | [string] 106 | $text, 107 | [ConsoleColor] 108 | $color 109 | ) 110 | 111 | $display = Write-Prompt -Object (" {0,-40}" -f $text) 112 | $display += Write-Prompt -Object (" {0,-40}" -f $color.ToString()) -BackgroundColor $color 113 | Write-Host $display 114 | } 115 | 116 | function Show-Colors { 117 | foreach ($color in [enum]::GetValues([ConsoleColor])) { 118 | Write-ColorPreview -text $color -color $color 119 | } 120 | } 121 | 122 | function Set-Theme { 123 | param( 124 | [Parameter(Mandatory=$true)] 125 | [string] 126 | $name 127 | ) 128 | 129 | if (Test-Path "$($sl.MyThemesLocation)\$($name).psm1") { 130 | $sl.CurrentThemeLocation = "$($sl.MyThemesLocation)\$($name).psm1" 131 | } 132 | elseif (Test-Path "$PSScriptRoot\Themes\$($name).psm1") { 133 | $sl.CurrentThemeLocation = "$PSScriptRoot\Themes\$($name).psm1" 134 | } 135 | elseif (Test-Path "$name") { 136 | $sl.CurrentThemeLocation = "$name" 137 | } 138 | else { 139 | Write-Host '' 140 | Write-Warning "Theme $name not found. Available themes are:" 141 | Get-Theme 142 | } 143 | 144 | Set-Prompt 145 | } 146 | 147 | # Helper function to create argument completion results 148 | function New-CompletionResult { 149 | param( 150 | [Parameter(Mandatory)] 151 | [string]$CompletionText, 152 | [string]$ListItemText = $CompletionText, 153 | [System.Management.Automation.CompletionResultType]$CompletionResultType = [System.Management.Automation.CompletionResultType]::ParameterValue, 154 | [string]$ToolTip = $CompletionText 155 | ) 156 | 157 | New-Object System.Management.Automation.CompletionResult $CompletionText, $ListItemText, $CompletionResultType, $ToolTip 158 | } 159 | 160 | function Get-Theme { 161 | ############################## 162 | #.SYNOPSIS 163 | # Get available theme(s) 164 | #.DESCRIPTION 165 | # Shows available themes, as well as their type and location 166 | # - Defaults (shipped with module) 167 | # - User (user defined themes) 168 | ############################## 169 | $themes = @() 170 | 171 | if (Test-Path "$($ThemeSettings.MyThemesLocation)\*") { 172 | Get-ChildItem -Path "$($ThemeSettings.MyThemesLocation)\*" -Include '*.psm1' -Exclude Tools.ps1 | ForEach-Object -Process { 173 | $themes += [PSCustomObject]@{ 174 | Name = $_.BaseName 175 | Type = "User" 176 | Location = $_.FullName 177 | } 178 | } 179 | } 180 | 181 | Get-ChildItem -Path "$PSScriptRoot\Themes\*" -Include '*.psm1' -Exclude Tools.ps1 | Sort-Object Name | ForEach-Object -Process { 182 | $themes += [PSCustomObject]@{ 183 | Name = $_.BaseName 184 | Type = "Defaults" 185 | Location = $_.FullName 186 | } 187 | } 188 | $themes 189 | } 190 | 191 | function ThemeCompletion { 192 | param( 193 | $commandName, 194 | $parameterName, 195 | $wordToComplete, 196 | $commandAst, 197 | $fakeBoundParameter 198 | ) 199 | $themes = Get-Theme 200 | $themes | 201 | Where-Object { $_.Name.ToLower().StartsWith($wordToComplete.ToLower()); } | 202 | Select-Object -Unique -ExpandProperty Name | 203 | ForEach-Object { New-CompletionResult -CompletionText $_ } 204 | } 205 | 206 | Register-ArgumentCompleter ` 207 | -CommandName Set-Theme ` 208 | -ParameterName name ` 209 | -ScriptBlock $function:ThemeCompletion 210 | 211 | $sl = $global:ThemeSettings #local settings 212 | $sl.ErrorCount = $global:error.Count 213 | --------------------------------------------------------------------------------