@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Service for managing application theme (light/dark mode).

    Note: This service is optional. If you only include the SCSS theme without injecting this service, the theme will still work correctly:

    • Light theme applies by default
    • Dark theme applies automatically via @media (prefers-color-scheme: dark)
    • All Material components are properly themed

    Use this service when you need:

    • User preference persistence - Saves theme choice to localStorage across sessions
    • Explicit theme override - Let users choose a theme different from system preference
    • Reactive state - Access isDarkMode() signal for conditional UI logic
    • Theme toggle - Programmatic control via toggleTheme() or setTheme()
    import { ThemeService } from '@theredhead/lucid-theme';

    @Component({...})
    export class AppComponent {
    private themeService = inject(ThemeService);

    toggleTheme() {
    this.themeService.toggleTheme();
    }
    }
    Index

    Constructors

    Properties

    isDarkMode: Signal<boolean> = ...

    Whether dark mode is currently active (resolved from mode + system preference)

    isLightMode: Signal<boolean> = ...

    Whether light mode is currently active

    systemPrefersDark: Signal<boolean> = ...

    Whether the system prefers dark mode

    themeMode: Signal<ThemeMode> = ...

    Current theme mode setting

    Methods

    • Reset to system preference

      Returns void

    • Set the theme mode

      Parameters

      • mode: ThemeMode

        The theme mode to set ('light', 'dark', or 'system')

      Returns void

    • Toggle between light and dark mode If currently in system mode, will switch to the opposite of current resolved theme

      Returns void