Skip to main content
Version: Next

Class: ColorThemeService

molecule.ColorThemeService

Hierarchy

Implements

Constructors

constructor

new ColorThemeService()

Overrides

GlobalEvent.constructor

Defined in

services/theme/colorThemeService.ts:101

Properties

colorTheme

Private colorTheme: IColorTheme = BuiltInColorTheme

Defined in

services/theme/colorThemeService.ts:99


colorThemes

Private colorThemes: IColorTheme[]

Defined in

services/theme/colorThemeService.ts:98

Methods

addThemes

addThemes(themes): void

Add themes into colorThemes

This will update the duplicated themes found in colorThemes

Parameters

NameType
themesIColorTheme | IColorTheme[]

Returns

void

Implementation of

IColorThemeService.addThemes

Defined in

services/theme/colorThemeService.ts:108


count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Inherited from

GlobalEvent.count

Defined in

common/event/eventBus.ts:28


emit

emit(name, ...args): void

Emit the service event

Parameters

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns

void

Inherited from

GlobalEvent.emit

Defined in

common/event/eventBus.ts:20


getColorTheme

getColorTheme(): IColorTheme

Get the current Color Theme

Returns

IColorTheme

Implementation of

IColorThemeService.getColorTheme

Defined in

services/theme/colorThemeService.ts:149


getColorThemeMode

getColorThemeMode(): ColorThemeMode

Get the mode('dark' or 'light') of the current Color Theme

Returns

ColorThemeMode

Implementation of

IColorThemeService.getColorThemeMode

Defined in

services/theme/colorThemeService.ts:191


getThemeById

getThemeById(id): undefined | IColorTheme

Get specific theme via id

Parameters

NameType
idstring

Returns

undefined | IColorTheme

Implementation of

IColorThemeService.getThemeById

Defined in

services/theme/colorThemeService.ts:144


getThemes

getThemes(): IColorTheme[]

Get all themes in colorThemes

Returns

IColorTheme[]

Implementation of

IColorThemeService.getThemes

Defined in

services/theme/colorThemeService.ts:178


onChange

onChange(callback): void

Listen to the theme changed event

Parameters

NameType
callback(prev: IColorTheme, next: IColorTheme, themeMode: ColorThemeMode) => void

Returns

void

Implementation of

IColorThemeService.onChange

Defined in

services/theme/colorThemeService.ts:214


reload

reload(): void

Reload current theme

Returns

void

Implementation of

IColorThemeService.reload

Defined in

services/theme/colorThemeService.ts:182


reset

reset(): void

Reset theme

Returns

void

Implementation of

IColorThemeService.reset

Defined in

services/theme/colorThemeService.ts:186


setTheme

setTheme(id): void

Set the current Color Theme via id, Please ensure the theme could be found in colorThemes

Parameters

NameType
idstring

Returns

void

Implementation of

IColorThemeService.setTheme

Defined in

services/theme/colorThemeService.ts:153


subscribe

subscribe(name, listener): void

Subscribe the service event

Parameters

NameTypeDescription
namestring | string[]Event name
listenerFunctionListener function

Returns

void

Inherited from

GlobalEvent.subscribe

Defined in

common/event/eventBus.ts:11


unsubscribe

unsubscribe(name, listener?): void

Unsubscribe the specific event and the listener function

Parameters

NameTypeDescription
nameanyThe event name
listener?Functionoptional, it unsubscribes events via name if not pass the listener function

Returns

void

Inherited from

GlobalEvent.unsubscribe

Defined in

common/event/eventBus.ts:37


updateTheme

updateTheme(theme): void

Update specific theme,

Parameters

NameType
themeIColorTheme

Returns

void

Implementation of

IColorThemeService.updateTheme

Defined in

services/theme/colorThemeService.ts:123