Files
gitea/web_src/js/webcomponents/index.ts
wxiaoguang f9f9876f2c Clean up AppURL, remove legacy origin-url webcomponent (#37090)
1. `origin-url` was introduced in the past when there was no good
framework support to detect current host url
    * It is not needed anymore
    * Removing it makes the code clearer
2. Separate template helper functions for different templates (web
page/mail)
3. The "AppURL" info is removed from admin config page: it doesn't
really help.
    * We already have various app url checks at many places
2026-04-03 17:56:31 +00:00

15 lines
580 B
TypeScript

import './polyfills.ts';
import './relative-time.ts';
import './overflow-menu.ts';
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();