This commit is contained in:
Timothy Jaeryang Baek committed 2026-12-02 03:58:13 +04:00
1 parent e4264ec664
commit 05e2a6bbe2
82 files changed
+811 -213

No files matched your search

+3 -5
View File
@@ -6,7 +6,7 @@ export type ThemeColors = Partial<Record<Mode, { bg: string; fg: string }>>;
// What the default greys are mixed from (see `--app-bg` / `--app-fg` in tailwind.css).
export const DEFAULT_THEME_COLORS: Record<Mode, { bg: string; fg: string }> = {
light: { bg: '#ffffff', fg: '#000000' },
dark: { bg: '#171717', fg: '#ffffff' }
dark: { bg: '#121212', fg: '#ffffff' }
};
export function getThemeColors(): ThemeColors {
@@ -26,9 +26,7 @@ export function setThemeColors(colors: ThemeColors): void {
// Keep in sync with the copy in app.html, which runs before first paint.
export function applyThemeColors(): void {
const root = document.documentElement;
const colors = root.classList.contains('her')
? undefined
: getThemeColors()[root.classList.contains('dark') ? 'dark' : 'light'];
const colors = getThemeColors()[root.classList.contains('dark') ? 'dark' : 'light'];
if (colors) {
root.style.setProperty('--app-bg', colors.bg);
root.style.setProperty('--app-fg', colors.fg);
@@ -51,7 +49,7 @@ export function setTheme(value: string): void {
root.classList.add(dark ? 'dark' : 'light');
document
.querySelector('meta[name="theme-color"]')
?.setAttribute('content', value === 'her' ? '#983724' : dark ? '#171717' : '#ffffff');
?.setAttribute('content', dark ? '#121212' : '#ffffff');
applyThemeColors();
window.applyTheme?.();
}