2024-07-07 17:32:30 +02:00
|
|
|
import './polyfills.ts';
|
2026-03-13 11:43:17 +01:00
|
|
|
import './relative-time.ts';
|
2024-07-07 17:32:30 +02:00
|
|
|
import './overflow-menu.ts';
|
2026-03-21 13:44:33 +01:00
|
|
|
import {isDarkTheme} from '../utils.ts';
|
|
|
|
|
|
|
|
|
|
function initPageThemeDarkLight() {
|
|
|
|
|
// Set page's theme color preference as early as possible, to avoid flicker of wrong theme color during page load.
|
|
|
|
|
const sync = () => document.documentElement.setAttribute('data-gitea-theme-dark', String(isDarkTheme()));
|
|
|
|
|
sync();
|
|
|
|
|
// Track system theme changes in case Gitea is using "auto" theme.
|
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', sync);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initPageThemeDarkLight();
|