Class ColorResolver
- Namespace
- SharpConsoleUI.Helpers
- Assembly
- SharpConsoleUI.dll
Provides centralized color resolution logic for controls. Resolution chain: explicit value → theme slot → Color.Transparent. null and Color.Default are treated identically (both mean "no explicit value").
public static class ColorResolver
- Inheritance
-
ColorResolver
- Inherited Members
Methods
ColorRoleBackground(ColorRole, IContainer?, bool, ColorRoleState, ThemeMode?)
Returns the role-derived background for a control with a role set, or null when the control has no role (so the caller falls through to its normal resolution path).
public static Color? ColorRoleBackground(ColorRole role, IContainer? container, bool outline, ColorRoleState state = ColorRoleState.Normal, ThemeMode? mode = null)
Parameters
roleColorRolecontainerIContaineroutlineboolstateColorRoleStatemodeThemeMode?
Returns
ColorRoleBorder(ColorRole, IContainer?, bool, ColorRoleState, ThemeMode?)
ColorRole-derived border, or null when no role.
public static Color? ColorRoleBorder(ColorRole role, IContainer? container, bool outline, ColorRoleState state = ColorRoleState.Normal, ThemeMode? mode = null)
Parameters
roleColorRolecontainerIContaineroutlineboolstateColorRoleStatemodeThemeMode?
Returns
ColorRoleForeground(ColorRole, IContainer?, bool, ColorRoleState, ThemeMode?)
ColorRole-derived foreground (the role colour used as text on the surface), or null when no role.
public static Color? ColorRoleForeground(ColorRole role, IContainer? container, bool outline, ColorRoleState state = ColorRoleState.Normal, ThemeMode? mode = null)
Parameters
roleColorRolecontainerIContaineroutlineboolstateColorRoleStatemodeThemeMode?
Returns
ColorRoleTextOnBackground(ColorRole, IContainer?, bool, ColorRoleState, ThemeMode?)
ColorRole-derived text-on-fill (foreground for a control whose fill is the role colour), or null when no role.
public static Color? ColorRoleTextOnBackground(ColorRole role, IContainer? container, bool outline, ColorRoleState state = ColorRoleState.Normal, ThemeMode? mode = null)
Parameters
roleColorRolecontainerIContaineroutlineboolstateColorRoleStatemodeThemeMode?
Returns
ResolveBackground(Color?, IContainer?)
Resolves a generic background color: explicit value → Color.Transparent. Controls without a specific theme slot are transparent by default. The container parameter is accepted for API consistency but not used — generic controls have no theme slot to fall back to.
public static Color ResolveBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveBarGraphBackground(Color?, IContainer?)
Resolves bar graph background: explicit → theme BarGraphBackgroundColor → Color.Transparent.
public static Color ResolveBarGraphBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveButtonBackground(Color?, IContainer?)
Resolves button background: explicit → theme ButtonBackgroundColor → Color.Transparent.
public static Color ResolveButtonBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveButtonDisabledBackground(Color?, IContainer?)
Resolves disabled button background: explicit → theme ButtonDisabledBackgroundColor → Color.Transparent.
public static Color ResolveButtonDisabledBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveButtonDisabledForeground(Color?, IContainer?, Color)
Resolves disabled button foreground color.
public static Color ResolveButtonDisabledForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveButtonFocusedBackground(Color?, IContainer?)
Resolves focused button background: explicit → theme ButtonFocusedBackgroundColor → Color.Transparent.
public static Color ResolveButtonFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveButtonFocusedForeground(Color?, IContainer?, Color)
Resolves focused button foreground color.
public static Color ResolveButtonFocusedForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveButtonForeground(Color?, IContainer?, Color)
Resolves button foreground color.
public static Color ResolveButtonForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveCheckboxBackground(Color?, IContainer?)
Resolves checkbox background: explicit → theme CheckboxBackgroundColor → Color.Transparent.
public static Color ResolveCheckboxBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveCheckboxDisabledBackground(Color?, IContainer?)
Resolves disabled checkbox background: explicit → theme CheckboxDisabledBackgroundColor → Color.Transparent.
public static Color ResolveCheckboxDisabledBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveCheckboxFocusedBackground(Color?, IContainer?)
Resolves focused checkbox background: explicit → theme CheckboxFocusedBackgroundColor → Color.Transparent.
public static Color ResolveCheckboxFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveCollapsibleHeaderFocusedBackground(Color?, IContainer?)
Resolves the background color for a focused CollapsiblePanel header: explicit → theme CollapsibleHeaderFocusedBackgroundColor → theme WindowBackgroundColor → Color.Transparent.
public static Color ResolveCollapsibleHeaderFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveCollapsibleHeaderFocusedForeground(Color?, IContainer?)
Resolves the foreground color for a focused CollapsiblePanel header: explicit → theme CollapsibleHeaderFocusedForegroundColor → theme ActiveTitleForegroundColor → Color.Cyan1.
public static Color ResolveCollapsibleHeaderFocusedForeground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveDatePickerBackground(Color?, IContainer?)
Resolves date picker background: explicit → theme DatePickerBackgroundColor → Color.Transparent.
public static Color ResolveDatePickerBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveDatePickerFocusedBackground(Color?, IContainer?)
Resolves date picker focused background: explicit → theme DatePickerFocusedBackgroundColor → Color.Transparent.
public static Color ResolveDatePickerFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveDatePickerFocusedForeground(Color?, IContainer?, Color)
Resolves date picker focused foreground color.
public static Color ResolveDatePickerFocusedForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveDatePickerForeground(Color?, IContainer?, Color)
Resolves date picker foreground color.
public static Color ResolveDatePickerForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveDatePickerSegmentBackground(Color?, IContainer?)
Resolves date picker segment background: explicit → theme DatePickerSegmentBackgroundColor → Color.Transparent.
public static Color ResolveDatePickerSegmentBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveDatePickerSegmentForeground(Color?, IContainer?, Color)
Resolves date picker segment foreground color.
public static Color ResolveDatePickerSegmentForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveDropdownBackground(Color?, IContainer?, Color)
Resolves dropdown background: explicit → theme MenuDropdownBackgroundColor → fallback.
public static Color ResolveDropdownBackground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveDropdownForeground(Color?, IContainer?, Color)
Resolves dropdown foreground color.
public static Color ResolveDropdownForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveDropdownHighlightBackground(Color?, IContainer?, Color)
Resolves dropdown highlight background: explicit → theme MenuDropdownHighlightBackgroundColor → fallback.
public static Color ResolveDropdownHighlightBackground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveDropdownHighlightForeground(Color?, IContainer?, Color)
Resolves dropdown highlight foreground color.
public static Color ResolveDropdownHighlightForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveForeground(Color?, IContainer?, Color)
Resolves a foreground color using the standard fallback chain: explicit value → container foreground → theme window foreground → default.
public static Color ResolveForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveLineGraphBackground(Color?, IContainer?)
Resolves line graph background: explicit → theme LineGraphBackgroundColor → Color.Transparent.
public static Color ResolveLineGraphBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveListBackground(Color?, IContainer?)
Resolves list background: explicit → theme ListBackgroundColor → Color.Transparent.
public static Color ResolveListBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveMenuBarBackground(Color?, IContainer?)
Resolves menu bar background: explicit → theme MenuBarBackgroundColor → Color.Transparent.
public static Color ResolveMenuBarBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveMenuBarForeground(Color?, IContainer?, Color)
Resolves menu bar foreground color.
public static Color ResolveMenuBarForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveMenuBarHighlightBackground(Color?, IContainer?, Color)
Resolves menu bar highlight background: explicit → theme MenuBarHighlightBackgroundColor → fallback.
public static Color ResolveMenuBarHighlightBackground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveMenuBarHighlightForeground(Color?, IContainer?, Color)
Resolves menu bar highlight foreground color.
public static Color ResolveMenuBarHighlightForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveMultilineEditBackground(Color?, IContainer?)
Resolves multiline edit background: explicit → theme PromptInputBackgroundColor → Color.Transparent.
public static Color ResolveMultilineEditBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveMultilineEditFocusedBackground(Color?, IContainer?)
Resolves focused multiline edit background: explicit → theme PromptInputFocusedBackgroundColor → Color.Transparent.
public static Color ResolveMultilineEditFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveSparklineBackground(Color?, IContainer?)
Resolves sparkline background: explicit → theme SparklineBackgroundColor → Color.Transparent.
public static Color ResolveSparklineBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveStartMenuBackground(Color?, ITheme?)
Resolves Start menu background: explicit → theme MenuDropdownBackgroundColor → Color.Grey15.
public static Color ResolveStartMenuBackground(Color? explicitValue, ITheme? theme)
Parameters
Returns
ResolveStartMenuForeground(Color?, ITheme?)
Resolves Start menu foreground: explicit → theme MenuDropdownForegroundColor → Color.Grey93.
public static Color ResolveStartMenuForeground(Color? explicitValue, ITheme? theme)
Parameters
Returns
ResolveStartMenuHeaderBackground(Color?, IContainer?)
Resolves Start menu header background: explicit → theme StartMenuHeaderBackgroundColor → MenuDropdownBackgroundColor → Color.Grey15.
public static Color ResolveStartMenuHeaderBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveStartMenuHeaderForeground(Color?, IContainer?)
Resolves Start menu header foreground: explicit → theme StartMenuHeaderForegroundColor → MenuDropdownForegroundColor → Color.Grey93.
public static Color ResolveStartMenuHeaderForeground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveStartMenuHighlightBackground(Color?, ITheme?)
Resolves Start menu highlight background: explicit → theme MenuDropdownHighlightBackgroundColor → Color.DarkBlue.
public static Color ResolveStartMenuHighlightBackground(Color? explicitValue, ITheme? theme)
Parameters
Returns
ResolveStartMenuHighlightForeground(Color?, ITheme?)
Resolves Start menu highlight foreground: explicit → theme MenuDropdownHighlightForegroundColor → Color.White.
public static Color ResolveStartMenuHighlightForeground(Color? explicitValue, ITheme? theme)
Parameters
Returns
ResolveStartMenuInfoStripForeground(Color?, IContainer?)
Resolves Start menu info strip foreground: explicit → theme StartMenuInfoStripForegroundColor → Color.DarkGray.
public static Color ResolveStartMenuInfoStripForeground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveStartMenuSectionHeaderBackground(Color?, IContainer?)
Resolves Start menu section header background: explicit → theme StartMenuSectionHeaderBackgroundColor → Color.Transparent.
public static Color ResolveStartMenuSectionHeaderBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveStatusBarBackground(Color?, IContainer?)
Resolves status bar background: explicit → theme StatusBarBackgroundColor → Color.Transparent.
public static Color ResolveStatusBarBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveStatusBarForeground(Color?, IContainer?, Color)
Resolves status bar foreground color.
public static Color ResolveStatusBarForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveStatusBarShortcutForeground(Color?, IContainer?, Color)
Resolves status bar shortcut foreground color.
public static Color ResolveStatusBarShortcutForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTabContentBorder(Color?, IContainer?, Color)
Resolves tab content border color.
public static Color ResolveTabContentBorder(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTabHeaderActiveBackground(Color?, IContainer?)
Resolves active tab header background: explicit → theme TabHeaderActiveBackgroundColor → Color.Transparent.
public static Color ResolveTabHeaderActiveBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTabHeaderActiveFocusedBackground(Color?, IContainer?)
Resolves active tab header background when the strip has focus: explicit → theme TabHeaderActiveFocusedBackgroundColor → theme TabHeaderActiveBackgroundColor → Color.Cyan1.
public static Color ResolveTabHeaderActiveFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTabHeaderActiveFocusedForeground(Color?, IContainer?)
Resolves active tab header foreground when the strip has focus: explicit → theme TabHeaderActiveFocusedForegroundColor → theme TabHeaderActiveForegroundColor → Color.Black.
public static Color ResolveTabHeaderActiveFocusedForeground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTabHeaderActiveForeground(Color?, IContainer?, Color)
Resolves active tab header foreground color.
public static Color ResolveTabHeaderActiveForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTabHeaderBackground(Color?, IContainer?)
Resolves inactive tab header background: explicit → theme TabHeaderBackgroundColor → Color.Transparent.
public static Color ResolveTabHeaderBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTabHeaderDisabledBackground(Color?, IContainer?)
Resolves disabled tab header background: explicit → theme TabHeaderDisabledBackgroundColor → Color.Transparent.
public static Color ResolveTabHeaderDisabledBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTabHeaderDisabledForeground(Color?, IContainer?, Color)
Resolves disabled tab header foreground color.
public static Color ResolveTabHeaderDisabledForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTabHeaderFocusedBackground(Color?, IContainer?)
Resolves inactive tab header background when the strip has focus: explicit → theme TabHeaderFocusedBackgroundColor → theme TabHeaderBackgroundColor → Color.Transparent.
public static Color ResolveTabHeaderFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTabHeaderFocusedForeground(Color?, IContainer?)
Resolves inactive tab header foreground when the strip has focus: explicit → theme TabHeaderFocusedForegroundColor → theme TabHeaderForegroundColor → Color.Grey.
public static Color ResolveTabHeaderFocusedForeground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTabHeaderForeground(Color?, IContainer?, Color)
Resolves inactive tab header foreground color.
public static Color ResolveTabHeaderForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTimePickerBackground(Color?, IContainer?)
Resolves time picker background: explicit → theme TimePickerBackgroundColor → Color.Transparent.
public static Color ResolveTimePickerBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTimePickerDisabledForeground(Color?, IContainer?, Color)
Resolves time picker disabled foreground color.
public static Color ResolveTimePickerDisabledForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTimePickerFocusedBackground(Color?, IContainer?)
Resolves time picker focused background: explicit → theme TimePickerFocusedBackgroundColor → Color.Transparent.
public static Color ResolveTimePickerFocusedBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTimePickerFocusedForeground(Color?, IContainer?, Color)
Resolves time picker focused foreground color.
public static Color ResolveTimePickerFocusedForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTimePickerForeground(Color?, IContainer?, Color)
Resolves time picker foreground color.
public static Color ResolveTimePickerForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTimePickerSegmentBackground(Color?, IContainer?)
Resolves time picker segment background: explicit → theme TimePickerSegmentBackgroundColor → Color.Transparent.
public static Color ResolveTimePickerSegmentBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTimePickerSegmentForeground(Color?, IContainer?, Color)
Resolves time picker segment foreground color.
public static Color ResolveTimePickerSegmentForeground(Color? explicitValue, IContainer? container, Color defaultColor = default)
Parameters
explicitValueColor?containerIContainerdefaultColorColor
Returns
ResolveTreeBackground(Color?, IContainer?)
Resolves tree background: explicit → theme TreeBackgroundColor → Color.Transparent.
public static Color ResolveTreeBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTreeSelectionBackground(Color?, IContainer?)
Resolves tree selection background (focused): explicit → theme TreeSelectionBackgroundColor → Color.Transparent.
public static Color ResolveTreeSelectionBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer
Returns
ResolveTreeUnfocusedSelectionBackground(Color?, IContainer?)
Resolves tree unfocused selection background: explicit → theme TreeUnfocusedSelectionBackgroundColor → Color.Transparent.
public static Color ResolveTreeUnfocusedSelectionBackground(Color? explicitValue, IContainer? container)
Parameters
explicitValueColor?containerIContainer