f2baf869c9
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>
27 lines
807 B
TypeScript
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');
|
|
}
|