VividLifePowerShell.psm1

# Generated by vivid-life-powershell — do not hand-edit.
# Edit src/module-template.mjs and rebuild.

$script:VividLifeThemes = @{
    'Midnight-Red' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(115, 115, 115)
        FgMuted = @(212, 212, 212)
        Comment = @(115, 115, 115)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(249, 115, 22)
        Accent = @(239, 68, 68)
        Parameter = @(253, 186, 116)
        TypeColor = @(234, 179, 8)
        Constant = @(249, 115, 22)
        FunctionColor = @(147, 197, 253)
        Info = @(147, 197, 253)
        Danger = @(252, 165, 165)
        Warning = @(253, 224, 71)
        Success = @(190, 242, 100)
        SelectionBg = @(42, 47, 58)
    }
    'Midnight-Orange' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(115, 115, 115)
        FgMuted = @(212, 212, 212)
        Comment = @(115, 115, 115)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(249, 115, 22)
        Accent = @(249, 115, 22)
        Parameter = @(253, 186, 116)
        TypeColor = @(234, 179, 8)
        Constant = @(249, 115, 22)
        FunctionColor = @(147, 197, 253)
        Info = @(147, 197, 253)
        Danger = @(252, 165, 165)
        Warning = @(253, 224, 71)
        Success = @(190, 242, 100)
        SelectionBg = @(42, 47, 58)
    }
    'Midnight-Yellow' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(115, 115, 115)
        FgMuted = @(212, 212, 212)
        Comment = @(115, 115, 115)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(249, 115, 22)
        Accent = @(234, 179, 8)
        Parameter = @(253, 186, 116)
        TypeColor = @(234, 179, 8)
        Constant = @(249, 115, 22)
        FunctionColor = @(147, 197, 253)
        Info = @(147, 197, 253)
        Danger = @(252, 165, 165)
        Warning = @(253, 224, 71)
        Success = @(190, 242, 100)
        SelectionBg = @(42, 47, 58)
    }
    'Midnight-Green' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(115, 115, 115)
        FgMuted = @(212, 212, 212)
        Comment = @(115, 115, 115)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(249, 115, 22)
        Accent = @(132, 204, 22)
        Parameter = @(253, 186, 116)
        TypeColor = @(234, 179, 8)
        Constant = @(249, 115, 22)
        FunctionColor = @(147, 197, 253)
        Info = @(147, 197, 253)
        Danger = @(252, 165, 165)
        Warning = @(253, 224, 71)
        Success = @(190, 242, 100)
        SelectionBg = @(42, 47, 58)
    }
    'Midnight-Blue' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(115, 115, 115)
        FgMuted = @(212, 212, 212)
        Comment = @(115, 115, 115)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(249, 115, 22)
        Accent = @(147, 197, 253)
        Parameter = @(253, 186, 116)
        TypeColor = @(234, 179, 8)
        Constant = @(249, 115, 22)
        FunctionColor = @(147, 197, 253)
        Info = @(147, 197, 253)
        Danger = @(252, 165, 165)
        Warning = @(253, 224, 71)
        Success = @(190, 242, 100)
        SelectionBg = @(42, 47, 58)
    }
    'Midnight-Purple' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(115, 115, 115)
        FgMuted = @(212, 212, 212)
        Comment = @(115, 115, 115)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(249, 115, 22)
        Accent = @(216, 180, 254)
        Parameter = @(253, 186, 116)
        TypeColor = @(234, 179, 8)
        Constant = @(249, 115, 22)
        FunctionColor = @(147, 197, 253)
        Info = @(147, 197, 253)
        Danger = @(252, 165, 165)
        Warning = @(253, 224, 71)
        Success = @(190, 242, 100)
        SelectionBg = @(42, 47, 58)
    }
    'Twilight-Red' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(163, 163, 163)
        FgMuted = @(212, 212, 212)
        Comment = @(163, 163, 163)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(253, 186, 116)
        Accent = @(252, 165, 165)
        Parameter = @(249, 115, 22)
        TypeColor = @(234, 179, 8)
        Constant = @(253, 186, 116)
        FunctionColor = @(147, 197, 253)
        Info = @(219, 234, 254)
        Danger = @(254, 226, 226)
        Warning = @(254, 249, 195)
        Success = @(190, 242, 100)
        SelectionBg = @(91, 91, 91)
    }
    'Twilight-Orange' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(163, 163, 163)
        FgMuted = @(212, 212, 212)
        Comment = @(163, 163, 163)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(253, 186, 116)
        Accent = @(253, 186, 116)
        Parameter = @(249, 115, 22)
        TypeColor = @(234, 179, 8)
        Constant = @(253, 186, 116)
        FunctionColor = @(147, 197, 253)
        Info = @(219, 234, 254)
        Danger = @(254, 226, 226)
        Warning = @(254, 249, 195)
        Success = @(190, 242, 100)
        SelectionBg = @(91, 91, 91)
    }
    'Twilight-Yellow' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(163, 163, 163)
        FgMuted = @(212, 212, 212)
        Comment = @(163, 163, 163)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(253, 186, 116)
        Accent = @(234, 179, 8)
        Parameter = @(249, 115, 22)
        TypeColor = @(234, 179, 8)
        Constant = @(253, 186, 116)
        FunctionColor = @(147, 197, 253)
        Info = @(219, 234, 254)
        Danger = @(254, 226, 226)
        Warning = @(254, 249, 195)
        Success = @(190, 242, 100)
        SelectionBg = @(91, 91, 91)
    }
    'Twilight-Green' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(163, 163, 163)
        FgMuted = @(212, 212, 212)
        Comment = @(163, 163, 163)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(253, 186, 116)
        Accent = @(132, 204, 22)
        Parameter = @(249, 115, 22)
        TypeColor = @(234, 179, 8)
        Constant = @(253, 186, 116)
        FunctionColor = @(147, 197, 253)
        Info = @(219, 234, 254)
        Danger = @(254, 226, 226)
        Warning = @(254, 249, 195)
        Success = @(190, 242, 100)
        SelectionBg = @(91, 91, 91)
    }
    'Twilight-Blue' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(163, 163, 163)
        FgMuted = @(212, 212, 212)
        Comment = @(163, 163, 163)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(253, 186, 116)
        Accent = @(147, 197, 253)
        Parameter = @(249, 115, 22)
        TypeColor = @(234, 179, 8)
        Constant = @(253, 186, 116)
        FunctionColor = @(147, 197, 253)
        Info = @(219, 234, 254)
        Danger = @(254, 226, 226)
        Warning = @(254, 249, 195)
        Success = @(190, 242, 100)
        SelectionBg = @(91, 91, 91)
    }
    'Twilight-Purple' = @{
        Fg = @(245, 245, 245)
        FgSubtle = @(163, 163, 163)
        FgMuted = @(212, 212, 212)
        Comment = @(163, 163, 163)
        Keyword = @(216, 180, 254)
        StringColor = @(132, 204, 22)
        NumberColor = @(253, 186, 116)
        Accent = @(216, 180, 254)
        Parameter = @(249, 115, 22)
        TypeColor = @(234, 179, 8)
        Constant = @(253, 186, 116)
        FunctionColor = @(147, 197, 253)
        Info = @(219, 234, 254)
        Danger = @(254, 226, 226)
        Warning = @(254, 249, 195)
        Success = @(190, 242, 100)
        SelectionBg = @(91, 91, 91)
    }
    'Dawn-Red' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(127, 29, 29)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(189, 189, 189)
    }
    'Dawn-Orange' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(124, 45, 18)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(189, 189, 189)
    }
    'Dawn-Yellow' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(113, 63, 18)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(189, 189, 189)
    }
    'Dawn-Green' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(54, 83, 20)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(189, 189, 189)
    }
    'Dawn-Blue' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(29, 78, 216)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(189, 189, 189)
    }
    'Dawn-Purple' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(126, 34, 206)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(189, 189, 189)
    }
    'Noon-Red' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(185, 28, 28)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(229, 229, 229)
    }
    'Noon-Orange' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(194, 65, 12)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(229, 229, 229)
    }
    'Noon-Yellow' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(113, 63, 18)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(229, 229, 229)
    }
    'Noon-Green' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(54, 83, 20)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(229, 229, 229)
    }
    'Noon-Blue' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(29, 78, 216)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(229, 229, 229)
    }
    'Noon-Purple' = @{
        Fg = @(23, 23, 23)
        FgSubtle = @(82, 82, 82)
        FgMuted = @(64, 64, 64)
        Comment = @(82, 82, 82)
        Keyword = @(126, 34, 206)
        StringColor = @(54, 83, 20)
        NumberColor = @(194, 65, 12)
        Accent = @(126, 34, 206)
        Parameter = @(124, 45, 18)
        TypeColor = @(113, 63, 18)
        Constant = @(194, 65, 12)
        FunctionColor = @(29, 78, 216)
        Info = @(30, 58, 138)
        Danger = @(127, 29, 29)
        Warning = @(113, 63, 18)
        Success = @(54, 83, 20)
        SelectionBg = @(229, 229, 229)
    }
}

function script:ConvertTo-VividLifeForeground([int[]]$Triple) {
    $PSStyle.Foreground.FromRgb($Triple[0], $Triple[1], $Triple[2])
}

function script:ConvertTo-VividLifeBackground([int[]]$Triple) {
    $PSStyle.Background.FromRgb($Triple[0], $Triple[1], $Triple[2])
}

function script:Set-VividLifeProperty([scriptblock]$Assign) {
    try { & $Assign } catch { }
}

function script:Set-VividLifeColors([hashtable]$Theme) {
    if (-not $PSStyle) {
        Write-Warning 'Vivid Life Theme requires PowerShell 7.2+ ($PSStyle). Skipping theme.'
        return
    }

    if (Get-Module -ListAvailable -Name PSReadLine) {
        Set-PSReadLineOption -Colors @{
            Default             = (ConvertTo-VividLifeForeground $Theme['Fg'])
            Comment             = (ConvertTo-VividLifeForeground $Theme['Comment'])
            Keyword             = (ConvertTo-VividLifeForeground $Theme['Keyword'])
            String              = (ConvertTo-VividLifeForeground $Theme['StringColor'])
            Number              = (ConvertTo-VividLifeForeground $Theme['NumberColor'])
            Command             = (ConvertTo-VividLifeForeground $Theme['Accent'])
            Parameter           = (ConvertTo-VividLifeForeground $Theme['Parameter'])
            Operator            = (ConvertTo-VividLifeForeground $Theme['Keyword'])
            Type                = (ConvertTo-VividLifeForeground $Theme['TypeColor'])
            Variable            = (ConvertTo-VividLifeForeground $Theme['Constant'])
            Member              = (ConvertTo-VividLifeForeground $Theme['FunctionColor'])
            Emphasis            = (ConvertTo-VividLifeForeground $Theme['Info'])
            Error               = (ConvertTo-VividLifeForeground $Theme['Danger'])
            ContinuationPrompt  = (ConvertTo-VividLifeForeground $Theme['FgSubtle'])
            InlinePrediction    = (ConvertTo-VividLifeForeground $Theme['FgSubtle'])
            Selection           = "$(ConvertTo-VividLifeForeground $Theme['Fg'])$(ConvertTo-VividLifeBackground $Theme['SelectionBg'])"
        }

        try {
            Set-PSReadLineOption -Colors @{
                ListPrediction         = (ConvertTo-VividLifeForeground $Theme['FgMuted'])
                ListPredictionSelected = "$(ConvertTo-VividLifeForeground $Theme['Fg'])$(ConvertTo-VividLifeBackground $Theme['SelectionBg'])"
            }
        } catch { }
    }

    Set-VividLifeProperty { $PSStyle.Formatting.FormatAccent = (ConvertTo-VividLifeForeground $Theme['Accent']) }
    Set-VividLifeProperty { $PSStyle.Formatting.TableHeader = $PSStyle.Bold + (ConvertTo-VividLifeForeground $Theme['Accent']) }
    Set-VividLifeProperty { $PSStyle.Formatting.CustomTableHeaderLabel = $PSStyle.Bold + (ConvertTo-VividLifeForeground $Theme['Accent']) }
    Set-VividLifeProperty { $PSStyle.Formatting.Error = (ConvertTo-VividLifeForeground $Theme['Danger']) }
    Set-VividLifeProperty { $PSStyle.Formatting.ErrorAccent = $PSStyle.Bold + (ConvertTo-VividLifeForeground $Theme['Danger']) }
    Set-VividLifeProperty { $PSStyle.Formatting.Warning = (ConvertTo-VividLifeForeground $Theme['Warning']) }
    Set-VividLifeProperty { $PSStyle.Formatting.Verbose = (ConvertTo-VividLifeForeground $Theme['Info']) }
    Set-VividLifeProperty { $PSStyle.Formatting.Debug = (ConvertTo-VividLifeForeground $Theme['FgSubtle']) }

    Set-VividLifeProperty { $PSStyle.FileInfo.Directory = $PSStyle.Bold + (ConvertTo-VividLifeForeground $Theme['Accent']) }
    Set-VividLifeProperty { $PSStyle.FileInfo.SymbolicLink = (ConvertTo-VividLifeForeground $Theme['Constant']) }
    Set-VividLifeProperty { $PSStyle.FileInfo.Executable = (ConvertTo-VividLifeForeground $Theme['Success']) }
}

function Set-VividLifeTheme {
    <#
    .SYNOPSIS
        Applies a Vivid Life Theme color scheme to PSReadLine and $PSStyle.
    .DESCRIPTION
        Sets PSReadLine syntax-highlighting colors and, on PowerShell 7.2+,
        $PSStyle.Formatting / $PSStyle.FileInfo colors for the given flavor
        and variant. Run it from your $PROFILE to apply on every session.
    .PARAMETER Flavor
        One of Midnight, Twilight, Dawn, Noon. Defaults to Midnight.
    .PARAMETER Variant
        One of Red, Orange, Yellow, Green, Blue, Purple. Defaults to Purple.
    .EXAMPLE
        Set-VividLifeTheme
        Applies the default Midnight/Purple theme.
    .EXAMPLE
        Set-VividLifeTheme -Flavor Dawn -Variant Blue
    #>

    [CmdletBinding()]
    param(
        [ValidateSet('Midnight', 'Twilight', 'Dawn', 'Noon')]
        [string]$Flavor = 'Midnight',

        [ValidateSet('Red', 'Orange', 'Yellow', 'Green', 'Blue', 'Purple')]
        [string]$Variant = 'Purple'
    )

    $key = "$Flavor-$Variant"
    $theme = $script:VividLifeThemes[$key]
    if (-not $theme) {
        throw "Unknown Vivid Life theme: $key"
    }

    Set-VividLifeColors -Theme $theme
}

Export-ModuleMember -Function Set-VividLifeTheme