Skip to content
@ng-doc/app / Class

NgDocThemeService

Service for managing themes.

The theme is the data-theme attribute of the document element: auto, dark, the id of a custom theme, or no attribute for the light theme.

Decorators
@Service
DeclarationTypeScript
@Service()
export class NgDocThemeService { … }

Members

Properties

5
change$: Subject<string | null>
protectedreadonly
—
document: Document
protectedreadonly
—
documentElement: HTMLElement
protectedreadonly
—
protectedreadonly
—
theme: Signal<string | null>
readonly

The current theme as a signal: the theme id, or null for the light theme.

It starts with the document's data-theme attribute and follows every set() call.

Accessors

1
get currentTheme: string | null

Returns the current theme: the document's data-theme attribute, or null without one.

Methods

2
(…): void

Sets the theme by id.

(): Observable<string | null>

Emits the theme after every set() call. Read theme for the current value as a signal.

Symbol
Kind
Class
Decorators
@Service
Scope
@ng-doc/app
Edit this page