Service for managing and switching between different themes in an application.

Implements

  • unknown

Constructors

  • Creates a new instance

    Parameters

    • registry: ThemeRegistryService

      Service for registering available themes

    • tracker: ThemeTrackingService

      Service for tracking the currently selected theme

    • manager: ThemeStyleManagerService

      Service for theme discovery, activation and deactivation

    • storage: StorageService

      Service for storing the currently selected theme in the browser storage

    • activatedRoute: ActivatedRoute

      Angular service for managing the current route

    • router: Router

      Angular service for navigating between routes

    • Optional storageKey: string

      Key for storing the currently selected theme in browser storage

    • Optional queryParam: string

      Query parameter name for specifying the theme in the route

    Returns ThemeService

Properties

#destroyed: any = ...

Subject for triggering cleanup on service destruction.

activatedRoute: ActivatedRoute

Angular service for managing the current route

currentTheme$: any = ...

Observable stream of all registered themes.

Service for theme discovery, activation and deactivation

queryParam?: string

Query parameter name for specifying the theme in the route

Service for registering available themes

router: Router

Angular service for navigating between routes

Service for storing the currently selected theme in the browser storage

storageKey?: string

Key for storing the currently selected theme in browser storage

themes$: any = ...

Observable stream that emits the currently active theme.

Service for tracking the currently selected theme

Accessors

  • get #themeFromRoute(): null | string
  • Private

    Gets the theme from the current route's query.

    Returns null | string

    • The current theme or null if the query param is not provided
  • get #themeFromStorage(): null | string
  • Private

    Gets the theme from the browser's storage.

    Returns null | string

    • The stored theme or null if the storage key is not provided

Methods

  • Private

    Updates the browser's url query params with the given theme ID.

    Does nothing if the query param is not provided.

    Parameters

    • theme: string

      The theme ID to update in the browser's url query params

    Returns void

  • Private

    Updates the theme ID in the browser's storage.

    Does nothing if the storage key is not provided.

    Parameters

    • theme: string

      The theme ID to save in the browser's storage

    Returns void

  • Internal

    Cleanup logic to be executed when the service is destroyed.

    Returns void

  • Select the theme to be used

    Parameters

    • theme: string

    Returns void