import { THEMES, getStoredThemeId, setStoredThemeId, applyTheme } from './themes.js';
const select = document.getElementById('themeSelect');
if (select) {
for (const theme of THEMES) {
const opt = document.createElement('option');
opt.value = theme.id;
opt.textContent = theme.label;
select.appendChild(opt);
}
select.value = getStoredThemeId();
select.addEventListener('change', () => {
const id = select.value;
setStoredThemeId(id);
applyTheme(id);
window.dispatchEvent(new CustomEvent('mobux:theme', { detail: id }));
});
}