feat: First iteration, multi themes, I18N
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Applies a theme's stylesheet. Texts are handled by i18n.js, mechanics are
|
||||
// shared (public/data); a theme is only a skin: colours, vocabulary, images.
|
||||
|
||||
export function applyThemeStyles(themeId) {
|
||||
document.documentElement.dataset.theme = themeId;
|
||||
|
||||
let link = document.getElementById('theme-css');
|
||||
if (!link) {
|
||||
link = document.createElement('link');
|
||||
link.id = 'theme-css';
|
||||
link.rel = 'stylesheet';
|
||||
document.head.append(link);
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
link.onload = link.onerror = () => resolve();
|
||||
link.href = `themes/${themeId}/theme.css`;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user