loader.ts — editorthemes
loader.tsregistry.ts
1import { readFile } from "node:fs/promises";
2import type { Theme, Variant } from "./types";
3
4const CACHE_TTL = 60_000;
5const cache = new Map<string, Theme>();
6
7/** Load a theme and keep it cached for a minute. */
8export async function loadTheme(slug: string): Promise<Theme> {
9 const cached = cache.get(slug);
10 if (cached) return cached;
11
12 const raw = await readFile(`themes/${slug}.json`, "utf8");
13 const theme: Theme = JSON.parse(raw);
14 theme.variants = theme.variants.filter((v: Variant) => v.enabled);■ Property 'enabled' does not exist on type 'Variant'.
15
16 cache.set(slug, theme);
17 setTimeout(() => cache.delete(slug), CACHE_TTL);
18 return theme;
19}
20
21export class ThemeRegistry {
22 #themes: Theme[] = [];
23
24 register(theme: Theme, isDefault = false): number {
25 this.#themes.push({ ...theme, isDefault });
26 return this.#themes.length;
27 }
28}
loader.tsM
registry.tsU
types.ts
index.ts
mainLine 13, Column 39Spaces: 2TypeScript
Install
Sublime Text
Sublime Text
Package · FreeRun Package Control: Install Package and pick “Civic Color Scheme”. Then run UI: Select Color Scheme.
Palette
Click a color to copy it
Interface
Syntax
Terminal
Details
- Author
- hum-n
- Price
- Free
- Source
- github.com/hum-n/civic
- Variants
- Civic
- Editors
- Sublime Text
Colors look wrong, or an editor is missing? Suggest a fix
Similar themes for Sublime Text
Closest dark palettes you can install in the same editor
Similar themes across editors
Close matches regardless of editor, with where each one is available