Theme Manager Engine (engine/theme-manager.ts)

lobsterai · src/renderer/theme/engine/theme-manager.ts · typescript · MIT
ui, database, lang:typescript

A robust theme management system for web applications, supporting persistence and system preference synchronization. Use this to implement dark/light mode switching.

// Source: https://github.com/netease-youdao/lobsterai | License: MIT | Copyright 2026 NetEase Youdao
// Provided via justclaw.it.com; keep this notice with the code.
import type { ThemeDefinition } from '../themes/types';

/** localStorage key read by index.html's pre-React splash to pick light/dark before any JS bundle loads */
export const THEME_APPEARANCE_STORAGE_KEY = 'lobster-theme-appearance';
/** Effective theme shared with companion windows, including an active skin's binding. */
export const THEME_ID_STORAGE_KEY = 'lobster-theme-id';

export interface ThemeStorage {
  get(key: string): string | null | Promise<string | null>;
  set(key: string, value: string): void | Promise<void>;
}

export interface ThemeManagerOptions {
  /** localStorage key for persistence. Default: 'lobster-

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key