jasonmarcher / PowerTab

Tab expansion module for PowerShell. Handles more content and provides a new, optional interface.
MIT License
108 stars 5 forks source link

Add function to preview theme #107

Open jasonmarcher opened 5 years ago

jasonmarcher commented 5 years ago

Convert this code into a usable function:

function Show-ConsoleListPreview {
    $Colors = $PowerTabConfig.ConsoleList.Colors
    Write-Host " " -NoNewLine
    Write-Host "┌─"           -ForegroundColor $Colors.BorderColor     -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host " I"           -ForegroundColor $Colors.BorderTextColor -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "tem "         -ForegroundColor $Colors.FilterColor     -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "───────────┐" -ForegroundColor $Colors.BorderColor     -BackgroundColor $Colors.BorderBackColor

    Write-Host " " -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "Item              "  -ForegroundColor $Colors.TextColor   -BackgroundColor $Colors.BackColor -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor
    Write-Host " " -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "Item Selected     "  -ForegroundColor $Colors.SelectedTextColor -BackgroundColor $Colors.SelectedBackColor -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor
    Write-Host " " -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "Item              "  -ForegroundColor $Colors.TextColor   -BackgroundColor $Colors.BackColor -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor
    Write-Host " " -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "Item              "  -ForegroundColor $Colors.TextColor   -BackgroundColor $Colors.BackColor -NoNewLine
    Write-Host "│"                   -ForegroundColor $Colors.BorderColor -BackgroundColor $Colors.BorderBackColor

    Write-Host " " -NoNewLine
    Write-Host "└─"           -ForegroundColor $Colors.BorderColor     -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "[1] 1-4 [4]"  -ForegroundColor $Colors.BorderTextColor -BackgroundColor $Colors.BorderBackColor -NoNewLine
    Write-Host "──────┘"      -ForegroundColor $Colors.BorderColor     -BackgroundColor $Colors.BorderBackColor
}

$themes = (dir .\Documents\WindowsPowerShell\Modules\PowerTab\ColorThemes\*.csv | select -ExpandProperty Name) -replace '.csv',''
$themes = $themes -replace 'Theme',''
$themes | ForEach-Object {
    Import-TabExpansionTheme $_
    Write-Host "Testing Theme $_"
    Write-Host ""
    Show-ConsoleListPreview
    Write-Host ""
    Write-Host ""
}