Stator.libPublic.Theme Namespace

Theming contracts and extension methods that let a plugin's own user interface follow the colour scheme of the Stator host application.

Remarks

The host exposes an IThemeService. A plugin reads Current for the active AppTheme and subscribes to ThemeChanged to be told when the user switches theme.

In the common case a plugin does not need to handle that event by hand: ApplyTheme(Control, AppTheme) recolours a control and its entire child tree in one call, and BindTheme(IThemeService, Control, ActionControl, AppTheme) wires up subscription and unsubscription for the lifetime of a control.

Implement IThemeAware on a form or control that needs to perform its own custom theming work.

See also the ready-made themed controls in Stator.libPublic.WinForms.

Classes

ThemeExtensions Extension methods which apply an AppTheme to Windows Forms controls.
ThemeServiceExtensions Extension methods for IThemeService which reduce theme handling in a plugin to a single call.

Structures

AppTheme An immutable snapshot of the colour scheme currently applied by the Stator host application.

Interfaces

IThemeAware Marks a form or control that performs its own theming, and gives the host a single method through which to ask it to do so.
IThemeService The theming service supplied by the Stator host application, through which a plugin can discover the active colour scheme and be notified when it changes.