Public/Get-GhostThemeSetting.ps1

function Get-GhostThemeSetting {
    <#
    .SYNOPSIS
        Gets the custom settings of the active theme of the Ghost site.

    .DESCRIPTION
        A theme can declare settings of its own in its package.json, under config.custom: a font, a layout, an
        address. Ghost Admin shows them under Settings > Design, and a template reads them as @custom. This
        returns them with their value on the site, their type, their default and, for a choice, the options.

        Only the settings of the theme that is active are returned.

        This needs a staff access token of an owner or an administrator: connect with the token of your profile
        page in Ghost Admin. Ghost refuses the Admin API key of an integration here, with NoPermissionError.

    .EXAMPLE
        Get-GhostThemeSetting

        Returns every custom setting of the active theme.

    .EXAMPLE
        Get-GhostThemeSetting -Key 'title_font', 'body_font'

        Returns the two settings for the fonts.

    .EXAMPLE
        Get-GhostThemeSetting | Where-Object { $_.value -ne $_.default }

        Returns the settings that were changed from what the theme starts with.

    .LINK
        https://docs.ghost.org/themes/custom-settings

    .LINK
        https://docs.ghost.org/admin-api
    #>

    [CmdletBinding()]
    [OutputType('Ghost.ThemeSetting')]
    param(
        # Keys of the settings to return, as the theme names them. Defaults to every setting.
        [Parameter(Position = 0)]
        [ValidateNotNullOrEmpty()]
        [string[]] $Key
    )

    begin {
        Test-GhostConnection
        $resources = Get-GhostAPIData -Endpoint $MyInvocation.MyCommand.Name
    }

    process {
        try {
            $uri = New-URIString -Endpoint $resources.URI
            $result = Submit-Request -Uri $uri -Method $resources.Method -Success $resources.Success
            $result = @(Test-ReturnFormat -Result $result -Location $resources.Result)

            if ($PSBoundParameters.ContainsKey('Key')) {
                foreach ($name in $Key) {
                    if (@($result | ForEach-Object { $_.key }) -notcontains $name) {
                        $known = @($result | ForEach-Object { $_.key } | Sort-Object) -join ', '
                        throw "The active theme has no setting '$name'. Its settings: $known."
                    }
                }
                $result = @($result | Where-Object { $Key -contains $_.key })
            }

            if ($result.Count -gt 0) {
                Set-ObjectTypeName -InputObject $result -TypeName $resources.TypeName
            }
        }
        catch {
            $PSCmdlet.ThrowTerminatingError($_)
        }
    }
}