Files
doki-theme-gitea/src/cssWriter.ts
T
codinget f2baf869c9 Add TypeScript theme generator for doki-master-theme palettes
Generates one Gitea-compatible CSS theme file per doki-master-theme
definition (88 themes). Each file contains a gitea-theme-meta-info
block and a :root block with the full set of CSS custom properties
derived from the character's colour palette.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 17:38:38 +00:00

27 lines
807 B
TypeScript

import type { ThemeConfig } from './types.js';
export function renderThemeCSS(theme: ThemeConfig, variables: Record<string, string>): string {
const isDark = theme.colorScheme === 'dark';
const lines: string[] = [];
lines.push('gitea-theme-meta-info {');
lines.push(` --theme-display-name: "${theme.displayName}";`);
lines.push(` --theme-color-scheme: "${theme.colorScheme}";`);
lines.push('}');
lines.push('');
lines.push(':root {');
for (const [name, value] of Object.entries(variables)) {
lines.push(` ${name}: ${value};`);
}
// Native CSS properties at the end (not custom properties)
lines.push(` accent-color: var(--color-accent);`);
lines.push(` color-scheme: ${isDark ? 'dark' : 'light'};`);
lines.push('}');
lines.push('');
return lines.join('\n');
}