Skip to content
ConsoleMonster
Cmdlet

Test-ConsoleTheme

Module
ConsoleMonster
Outputs
ConsoleMonster.Styling.ThemeCheckReport

Checks a theme's text contrast, status colours, markers and critical fill.

Syntax

Test-ConsoleTheme
[-Background <String>]
[-Detailed]
[-Strict]
[-Theme <String>]
[<CommonParameters>]
#
Parameter set: Name
Test-ConsoleTheme
[-Background <String>]
[-Detailed]
[-Path] <String>
[-Strict]
[<CommonParameters>]
#
Parameter set: Path

Description

Checks the active theme, a named preset, or a JSON/PSD1 file without changing settings. Text needs WCAG contrast of 4.5:1 against its own fill or the page background. Pass, warning and fail need CIELAB distance 25 in normal vision and full-severity Machado protanopia, deuteranopia and tritanopia simulations. Markers must differ without colour. Critical may share Fail's hue when it has a distinct fill. The Terminal preset is measured against the startup palette when the terminal answers OSC 4/10/11. Otherwise the actual colours of palette indexes, terminal-default text and terminal-dependent dimming cannot be measured; Unknown prevents a confirmed pass but is not a failure. The output report has Passed and Results properties and a verdict-first default view showing problems and unknowns. Use -Detailed for every check. Dark and Light are not colour-blind-safe presets.

Examples

Example 1

Test-ConsoleTheme

Check the active theme.

Example 2

Test-ConsoleTheme -Path ./team-theme.json -Strict

Check a team theme in CI; any failure stops the script.

Example 3

(Test-ConsoleTheme -Theme Light -Background '#ffffff').Results | Where-Object Outcome -EQ Fail

Inspect individual measurements as objects.

Example 4

Test-ConsoleTheme -Theme Dark -Detailed

Show every measurement.

Parameters

-Background String optional
The page colour, as a name or #rrggbb. Defaults to #0c0c0c for a dark preset and #ffffff for a light preset. A token's own background takes precedence. Palette-index backgrounds remain unknown.
-Detailed SwitchParameter optional
Shows every measurement instead of only problems and unknowns. The Results property always contains every check.
-Strict SwitchParameter optional
Makes any Fail a terminating ConsoleThemeCheckFailed error with the report as its target. Unknown alone does not throw.
-Theme String optionalsets: Name
A built-in preset, catalogue scheme or family. Catalogue names accept · accessible. Omit both Theme and Path to check the active theme. Paired families and ColorBlindSafe select the detected background; explicit variant names choose one.
-Path String requiredposition: 0sets: Path
A literal .json or restricted .psd1 theme file. Relative paths use the current PowerShell location.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.