ThemeProvider class

The ThemeProvider class provides the capability to get different themes from the Framework. Themes can be provided in different contexts, e.g. Canvas sections may provide a variant of the global theme in some contexts.

Constructors

(constructor)(serviceScope, theme)

Construct a new instance of the ThemeProvider class.

Properties

serviceKey

The service key for ThemeProvider.

Methods

tryGetTheme()

If set, get the current scoped theme.

Events

themeChangedEvent

Raised when the theme changes with the new theme as an argument.

Constructor Details

(constructor)(serviceScope, theme)

Construct a new instance of the ThemeProvider class.

constructor(serviceScope: ServiceScope, theme?: ITheme);

Parameters

serviceScope
ServiceScope

The current service scope.

theme
ITheme

Theme to provide.

Property Details

serviceKey

The service key for ThemeProvider.

static readonly serviceKey: ServiceKey<ThemeProvider>;

Property Value

Method Details

tryGetTheme()

If set, get the current scoped theme.

tryGetTheme(): IReadonlyTheme | undefined;

Returns

IReadonlyTheme | undefined

Event Details

themeChangedEvent

Raised when the theme changes with the new theme as an argument.

readonly themeChangedEvent: SPEvent<ThemeChangedEventArgs>;

Event Type