Indicate if themes support light or dark modes, or both

This commit is contained in:
2026-08-29 01:41:16 +00:00
parent 794e1ba26e
commit d21c3edbfc
4 changed files with 52 additions and 9 deletions
+10 -3
View File
@@ -56,12 +56,19 @@ const brand = ref('')
const theme = ref('')
// Theme options come from the backend (theme folders on disk, see GET
// /_api/settings), so added themes need no frontend changes.
const themeOptions = ref([{ value: '', label: 'none' }])
const themeOptions = ref([{ value: '', label: '☀️ none' }])
// Page transition (cube, crossfade, ...): a design folder with
// transition.css under pagerite/themes/, injected as #pagerite-transition.
const transition = ref('cube')
const transitionOptions = ref([])
// Mode icons match the ones used in the Paskia auth frontend.
const MODE_ICONS = { light: '☀️', dark: '🌙', both: '🌓' }
function themeLabel(t) {
return `${MODE_ICONS[t.mode] || MODE_ICONS.light} ${t.name}`
}
async function loadSettings() {
try {
const s = await (await fetch('/_api/settings')).json()
@@ -73,8 +80,8 @@ async function loadSettings() {
customCss.value = s.custom_css || ''
favicon.value = s.favicon || ''
themeOptions.value = [
{ value: '', label: 'none' },
...(s.themes || []).map((t) => ({ value: t, label: t })),
{ value: '', label: `${MODE_ICONS.light} none` },
...(s.themes || []).map((t) => ({ value: t.name, label: themeLabel(t) })),
]
transition.value = s.transition || 'cube'
transitionOptions.value = s.transitions || []