Update boot.ts

This commit is contained in:
syuilo 2024-08-27 20:58:35 +09:00
parent dec4a40bfd
commit 374dce7ff8
1 changed files with 18 additions and 1 deletions

View File

@ -24,7 +24,24 @@ const embedParams = parseEmbedParams(params);
console.info(embedParams); console.info(embedParams);
applyTheme(darkTheme); if (embedParams.colorMode === 'dark') {
applyTheme(darkTheme);
} else if (embedParams.colorMode === 'light') {
applyTheme(lightTheme);
} else {
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
applyTheme(darkTheme);
} else {
applyTheme(lightTheme);
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (mql) => {
if (mql.matches) {
applyTheme(darkTheme);
} else {
applyTheme(lightTheme);
}
});
}
// サイズの制限 // サイズの制限
document.documentElement.style.maxWidth = '500px'; document.documentElement.style.maxWidth = '500px';