From a2888a883bab6d4f45e7e28e06457d9f926b531b Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Tue, 12 Oct 2021 01:31:28 -0400 Subject: [PATCH] =Fixed styling error on load --- base/Setup-MyPowerLineTheme.ps1 | 39 +++++++++++++++++++++++---------- base/profile.d/Style.ps1 | 17 +++++++++++++- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/base/Setup-MyPowerLineTheme.ps1 b/base/Setup-MyPowerLineTheme.ps1 index aedc92a..3d6f83a 100644 --- a/base/Setup-MyPowerLineTheme.ps1 +++ b/base/Setup-MyPowerLineTheme.ps1 @@ -5,19 +5,34 @@ $local:MyPowerLineSetup = [ordered]@{ SetCurrentDirectory = $true RestoreVirtualTerminal = $true PowerLineCharacters = [ordered]@{ - ColorSeparator = "$([char]::ConvertFromUtf32(0x2588) - )$([PoshCode.Pansies.Entities]::ExtendedCharacters.ColorSeparator.Trim()[-1]) " - ReverseColorSeparator = " $( - [PoshCode.Pansies.Entities]::ExtendedCharacters.ReverseColorSeparator.Trim()[0] - )$([char]::ConvertFromUtf32(0x2588))" - # Separator = " $([PoshCode.Pansies.Entities]::ExtendedCharacters.Separator.Trim()[-1]) " - Separator = "$([PoshCode.Pansies.Entities]::NerdFonts['nf-fa-angle_right'])" - ReverseSeparator = " $( - [PoshCode.Pansies.Entities]::ExtendedCharacters.ReverseSeparator.Trim()[0]) " + ColorSeparator = "$( + $PromptCache.ColorFiller + )$( $PromptCache.Separator.Trim() + )$( " " + )" + ReverseColorSeparator = "$( + " " + )$( $PromptCache.ReverseSeparator.Trim() + )$( $PromptCache.ColorFiller + )" + Separator = $( + [PoshCode.Pansies.Entities]::NerdFonts['nf-fa-angle_right'] + ) + ReverseSeparator = $( + [PoshCode.Pansies.Entities]::NerdFonts['nf-fa-angle_left'] + ) } - Colors = @( [rgbcolor]"Grey18", [rgbcolor]"Grey65" ) #, [rgbcolor]"white", [rgbcolor]"red", [rgbcolor]"blue" ) + Colors = [PoshCode.Pansies.RgbColor]::X11Palette | + Where-Object X11ColorName -match "^Gray\d" | + Sort-Object X11ColorName -Unique | + Where-Object { + 0 -eq $([int]($_.X11ColorName -replace 'Gray','') % 11) + } + #@( [rgbcolor]"Grey18", [rgbcolor]"Grey65" ) + #([rgbcolor]::ConsolePalette | Where ConsoleColor -eq ((get-host).ui.rawui.BackgroundColor)), + #@( [rgbcolor]"Grey18", [rgbcolor]"Grey65" ) #, [rgbcolor]"white", [rgbcolor]"red", [rgbcolor]"blue" ) Prompt = @( - { "`n" } # A spaced line + { Write-Host "" } # A spaced line without a ColorSeparator { New-PromptText -EBg VioletRed4 $MyInvocation.HistoryId } { Get-SegmentedPath -LengthLimit 30 } { Write-VcsStatus } @@ -31,7 +46,7 @@ $local:MyPowerLineSetup = [ordered]@{ { "$PSOSName " } { "`n" } - { New-PromptText { "PS" } -Ebg Red } + { New-PromptText { "PS" } -Bg $Prompt.Colors[1] -Ebg Red } ) } Set-PowerLinePrompt @MyPowerLineSetup diff --git a/base/profile.d/Style.ps1 b/base/profile.d/Style.ps1 index f896de7..ecff929 100644 --- a/base/profile.d/Style.ps1 +++ b/base/profile.d/Style.ps1 @@ -17,7 +17,7 @@ Get-Command -ListImported Get-GitDirectory -ErrorAction Ignore | $local:g = $global:GitPromptSettings $g.WorkingColor.ForegroundColor = [System.ConsoleColor]::DarkYellow $g.TruncatedBranchSuffix = [char]0x2026 - $g.PathStatusSeparator = [PoshCode.Pansies.Entities]::ExtendedCharacters.Branch + $g.PathStatusSeparator = "$([char]0xE0A0)" #[PoshCode.Pansies.Entities]::ExtendedCharacters.Branch $g.BeforeStatus.Text = [string]::Empty $g.AfterStatus.Text = [string]::Empty $g.BranchGoneStatusSymbol.Text = [char]0x2262 @@ -37,6 +37,21 @@ if( (Get-Command -ListImported Set-PowerLinePrompt -ErrorAction Ignore) ) { OSName = [SystemName]::_GetValidValues("",$true,$true) | Select-Object -First 1 Username = @($env:USER, $env:USERNAME -ne "")[0] Hostname = $(hostname).Trim() + ColorFiller = $([char]0x2588) + Separator = " $( + [PoshCode.Pansies.Entities]::NerdFonts['nf-pl-left_hard_divider'] + )" + ReverseSeparator = "$( + [PoshCode.Pansies.Entities]::NerdFonts['nf-pl-right_hard_divider'] + ) " + # Separator = "$( + # [char]::ConvertFromUtf32(0x2588) + # )$( [PoshCode.Pansies.Entities]::ExtendedCharacters.ColorSeparator.Trim()[-1] + # ) " + # ReverseSeparator = " $( + # [PoshCode.Pansies.Entities]::ExtendedCharacters.ColorSeparator.Trim()[0] + # )$( [char]::ConvertFromUtf32(0x2588))" + } Set-PowerLinePrompt