Private/Show-DLLPickleLogo.ps1

#!/usr/bin/env pwsh

function Show-DPLogo {
    <#
.SYNOPSIS
Displays the DLLPickle logo in the console.
 
.DESCRIPTION
Displays the DLLPickle logo in the console using ANSI escape codes for color rendering.
 
.EXAMPLE
Show-DPLogo
 
.NOTES
Auto-generated by PX2PS 2025.12.29 (@JakeHildreth)
Source: DLLPickle.px (39x9)
Credit: @JakeHildreth (https://jakehildreth.com)
Generated: 2026-02-01 20:13:01
#>


    [CmdletBinding()]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification = 'This function is specifically designed to render a colorful ASCII art logo using ANSI escape codes, which requires Write-Host for proper color rendering.')]
    param ()

    # Don't [attempt to] show the logo in the Windows PowerShell ISE.
    if ($Host.Name -eq 'Windows PowerShell ISE Host') { return }

    # Enable Virtual Terminal Processing for ANSI colors (Windows PowerShell 5.1 compatibility)
    if ($PSVersionTable.PSVersion.Major -le 5 -and $env:OS -eq 'Windows_NT') {
        try {
            Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
public class VTConsole {
    [DllImport("kernel32.dll", SetLastError = true)]
    public static extern IntPtr GetStdHandle(int nStdHandle);
    [DllImport("kernel32.dll", SetLastError = true)]
    public static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode);
    [DllImport("kernel32.dll", SetLastError = true)]
    public static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode);
    public static void EnableVT() {
        IntPtr handle = GetStdHandle(-11);
        uint mode;
        GetConsoleMode(handle, out mode);
        SetConsoleMode(handle, mode | 0x4);
    }
}
'@
 -ErrorAction SilentlyContinue
            [VTConsole]::EnableVT()
        } catch {
            Write-Verbose "Failed to enable Virtual Terminal Processing: $_. This may affect color rendering, but the logo will still be displayed. If you are using Windows PowerShell, consider upgrading to PowerShell 7 or later for improved ANSI support."
            # VT processing may already be enabled or not available
        }
    }

    $ESC = [char]27
    $LowerHalfBlock = [char]0x2584

    function Get-TrueColorFg {
        param([int]$R, [int]$G, [int]$B)
        return "$ESC[38;2;${R};${G};${B}m"
    }

    function Get-TrueColorBg {
        param([int]$R, [int]$G, [int]$B)
        return "$ESC[48;2;${R};${G};${B}m"
    }

    $width = 39
    $height = 9
    $pixels = @(
        @(31, 175, 28, 255),
        @(35, 177, 28, 255),
        @(40, 180, 29, 255),
        @(45, 182, 30, 255),
        @(50, 185, 31, 255),
        @(55, 187, 32, 255),
        @(60, 190, 32, 255),
        @(65, 192, 33, 255),
        @(70, 195, 34, 255),
        @(75, 197, 35, 255),
        @(80, 200, 36, 255),
        @(85, 202, 36, 255),
        @(90, 205, 37, 255),
        @(95, 207, 38, 255),
        @(100, 209, 39, 255),
        @(105, 212, 39, 255),
        @(110, 215, 40, 255),
        @(115, 217, 41, 255),
        @(120, 219, 42, 255),
        @(125, 222, 43, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(63, 179, 41, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(31, 175, 28, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(0, 0, 0, 255),
        @(130, 225, 44, 255),
        @(31, 175, 28, 255),
        @(35, 177, 28, 255),
        @(40, 180, 29, 255),
        @(45, 182, 30, 255),
        @(50, 185, 31, 255),
        @(55, 187, 32, 255),
        @(60, 190, 32, 255),
        @(65, 192, 33, 255),
        @(70, 195, 34, 255),
        @(75, 197, 35, 255),
        @(80, 200, 36, 255),
        @(85, 202, 36, 255),
        @(90, 205, 37, 255),
        @(95, 207, 38, 255),
        @(100, 209, 39, 255),
        @(105, 212, 39, 255),
        @(110, 215, 40, 255),
        @(115, 217, 41, 255),
        @(120, 219, 42, 255),
        @(125, 222, 43, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255),
        @(130, 225, 44, 255)
    )

    $oddHeight = ($height % 2) -eq 1
    $startY = if ($oddHeight) { -1 } else { 0 }
    $endY = if ($oddHeight) { $height - 1 } else { $height }

    for ($y = $startY; $y -lt $endY; $y += 2) {
        $line = ''
        for ($x = 0; $x -lt $width; $x++) {
            $topY = $y
            $bottomY = $y + 1

            if ($topY -lt 0) {
                $topPixel = $null
            } else {
                $topIdx = ($topY * $width) + $x
                $topPixel = if ($topIdx -lt $pixels.Count) { $pixels[$topIdx] } else { @(0, 0, 0, 0) }
            }

            $bottomIdx = ($bottomY * $width) + $x
            $bottomPixel = if ($bottomIdx -lt $pixels.Count) { $pixels[$bottomIdx] } else { @(0, 0, 0, 0) }

            $botR = if ($bottomPixel[3] -lt 32) { 0 } else { $bottomPixel[0] }
            $botG = if ($bottomPixel[3] -lt 32) { 0 } else { $bottomPixel[1] }
            $botB = if ($bottomPixel[3] -lt 32) { 0 } else { $bottomPixel[2] }

            if ($null -eq $topPixel) {
                $fg = Get-TrueColorFg -R $botR -G $botG -B $botB
                $line += "${fg}$LowerHalfBlock"
            } else {
                $topR = if ($topPixel[3] -lt 32) { 0 } else { $topPixel[0] }
                $topG = if ($topPixel[3] -lt 32) { 0 } else { $topPixel[1] }
                $topB = if ($topPixel[3] -lt 32) { 0 } else { $topPixel[2] }

                $bg = Get-TrueColorBg -R $topR -G $topG -B $topB
                $fg = Get-TrueColorFg -R $botR -G $botG -B $botB
                $line += "${bg}${fg}$LowerHalfBlock"
            }
        }
        $line += "$ESC[0m$ESC[K"
        Write-Host $line
    }

    Write-Host ''
}