UNPKG

alacritty-theme-switch

Version:
43 lines (42 loc) 1.36 kB
import { basename } from "../../deps/jsr.io/@std/path/1.1.4/basename.js"; import { unslugify } from "../utils/string-utils.js"; import { detectThemeBrightness } from "../utils/theme-utils.js"; /** * Theme represents a color theme for Alacritty. */ export class Theme { constructor(path, themeContent = {}, isCurrentlyActive = null) { /** Path to the theme file */ Object.defineProperty(this, "path", { enumerable: true, configurable: true, writable: true, value: void 0 }); /** Whether the theme is currently active */ Object.defineProperty(this, "isCurrentlyActive", { enumerable: true, configurable: true, writable: true, value: void 0 }); /** Parsed theme content */ Object.defineProperty(this, "themeContent", { enumerable: true, configurable: true, writable: true, value: void 0 }); this.path = path; this.themeContent = themeContent; this.isCurrentlyActive = isCurrentlyActive; } /** Human-readable theme name */ get label() { return unslugify(basename(this.path)); } /** Theme brightness */ get brightness() { return detectThemeBrightness(this.themeContent); } }