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>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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');
|
||||
}
|
||||
Reference in New Issue
Block a user