Skip to content

Theme Service

Overview

The ThemeService manages document themes used for categorising and organising content. It loads themes from a configuration file and provides methods to retrieve and manipulate theme data.

Key Methods

getStructuredThemes

getStructuredThemes(): { [key: string]: Theme }

Converts raw theme configuration into structured theme objects:

  • Generates unique IDs for each theme
  • Formats themes with name and description
  • Returns themes indexed by name

getThemesByNames

getThemesByNames(themeNames: string[]): Theme[]

Retrieves themes by their names:

  • Filters themes based on provided names
  • Returns an array of matching theme objects
  • Ignores names that don't match existing themes

getAllThemes

getAllThemes(): Theme[]

Retrieves all available themes:

  • Returns an array of all theme objects
  • Includes ID, name, and description for each theme

Theme Interface

interface Theme {
  id: string; // Unique identifier
  name: string; // Theme name
  description: string; // Theme description
}