Table of Contents

Class ColorRoleResolver

Namespace
SharpConsoleUI.Helpers
Assembly
SharpConsoleUI.dll

Derives a coordinated ColorRoleSet set from a single ColorRole, using per-theme seed colours (theme.PrimaryColor and friends) with a fall back to built-in defaults, plus the two non-null theme anchors. Pure and reflection-free — the single derivation brain shared by controls and the palette theme generator.

public static class ColorRoleResolver
Inheritance
ColorRoleResolver
Inherited Members

Methods

Resolve(ColorRole, IContainer?, bool, ColorRoleState, ThemeMode?)

Resolves the coordinated colour set for role using the active theme of the supplied container (falling back to built-in defaults when the container or its window system is null).

public static ColorRoleSet Resolve(ColorRole role, IContainer? container, bool outline = false, ColorRoleState state = ColorRoleState.Normal, ThemeMode? mode = null)

Parameters

role ColorRole

The semantic role to resolve.

container IContainer

The container whose window-system theme supplies the anchors, or null.

outline bool

When true, the role colour is used as text/border on the surface instead of as a fill.

state ColorRoleState

The interaction state (Normal, Focused, Disabled).

mode ThemeMode?

When non-null, overrides the theme's ThemeMode for the dark/light seed-colour decision. When null, the theme's own mode is used.

Returns

ColorRoleSet

A coordinated, contrast-checked ColorRoleSet.

Resolve(ColorRole, ITheme, bool, ColorRoleState, ThemeMode?)

Resolves the coordinated colour set for role against the supplied theme's two non-null anchors.

public static ColorRoleSet Resolve(ColorRole role, ITheme theme, bool outline = false, ColorRoleState state = ColorRoleState.Normal, ThemeMode? mode = null)

Parameters

role ColorRole

The semantic role to resolve.

theme ITheme

The theme supplying the surface anchors and mode.

outline bool

When true, the role colour is used as text/border on the surface instead of as a fill.

state ColorRoleState

The interaction state (Normal, Focused, Disabled).

mode ThemeMode?

When non-null, overrides theme's ThemeMode for the dark/light seed-colour decision. When null, the theme's own mode is used.

Returns

ColorRoleSet

A coordinated, contrast-checked ColorRoleSet.