Themes: Dracula, Material, Adwaita, Flat Remix, Paper, Nordic, each light, dark or Auto
The theme picker lists Modern (the old Dark and Light), Classic and six new palettes, from Dracula's spec (with Alucard), Material 3's baseline scheme, libadwaita's CSS variables, Flat Remix's _colors.scss, Paper and Nord. A second setting picks Light, Dark or Auto where a theme has both; Classic and Paper do not, so it is hidden for them. The page gets data-mode, light or dark, and Auto is worked out in theme.ts from the system, so each palette is written once instead of again under a media query. Every new palette clears WCAG AA for text on its backgrounds. An old ipx.theme of dark, light or auto carries over as Modern. Closes #27. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -333,10 +333,12 @@ async function prefsModal(){
|
||||
const admin = !!(S.me&&S.me.admin);
|
||||
openModal(`<h3>Settings</h3>
|
||||
<div class="field"><label>Theme</label>
|
||||
<select id="stheme">${THEME_ORDER.map(t=>
|
||||
`<option value="${t}"${document.documentElement.dataset.theme===t?' selected':''}>${THEMES[t]}</option>`).join('')}</select>
|
||||
<span class="hint">Auto follows your system's light/dark setting. The same toggle is in
|
||||
the header, one click at a time; this jumps straight to the one you want.</span></div>
|
||||
<select id="stheme">${Object.entries(THEMES).map(([k,t])=>
|
||||
`<option value="${k}"${theme.name===k?' selected':''}>${esc(t.name)}</option>`).join('')}</select></div>
|
||||
<div class="field" id="smodefield"${THEMES[theme.name].modes?'':' hidden'}><label>Light or dark</label>
|
||||
<select id="smode">${Object.entries(MODES).map(([k,t])=>
|
||||
`<option value="${k}"${theme.mode===k?' selected':''}>${esc(t)}</option>`).join('')}</select>
|
||||
<span class="hint">Auto follows your system's light/dark setting.</span></div>
|
||||
<div class="field"><label>Check feeds every</label>
|
||||
${admin?`<div class="inline">
|
||||
<input type="number" id="gnum" min="1" max="999" value="${gs.n}">
|
||||
@@ -378,6 +380,7 @@ async function prefsModal(){
|
||||
<div class="cardacts"><button class="btn ico" onclick="closeModal()" title="${admin?'Cancel':'Close'}" aria-label="${admin?'Cancel':'Close'}">${ICON.close}</button>
|
||||
${admin?`<button class="btn ico primary" id="gsave" title="Save" aria-label="Save">${ICON.check}</button>`:''}</div>`);
|
||||
$('#stheme').onchange=e=>setTheme(e.target.value);
|
||||
$('#smode').onchange=e=>setTheme(undefined,e.target.value);
|
||||
$('#gopml').onclick=opmlModal;
|
||||
if(!admin) return;
|
||||
$('#gusers').onclick=usersModal;
|
||||
@@ -594,15 +597,4 @@ $('#feedlist').onkeydown=ev=>{
|
||||
};
|
||||
$('#burger').onclick=()=>nav(!$('#sidebar').classList.contains('open'));
|
||||
$('#scrim').onclick=()=>nav(false);
|
||||
// Dark, light, the 2004 Mac app, and following the system, chosen in Settings and kept in
|
||||
// ipx.theme.
|
||||
const THEMES={dark:'Dark',light:'Light',classic:'Classic, the 2004 Mac app',auto:'Auto (matches your system)'};
|
||||
const THEME_ORDER=Object.keys(THEMES);
|
||||
function setTheme(t){
|
||||
if(!THEMES[t]) t='dark';
|
||||
document.documentElement.dataset.theme=t;
|
||||
const sel=$('#stheme'); if(sel) sel.value=t;
|
||||
try{ localStorage.setItem('ipx.theme',t); }catch{}
|
||||
}
|
||||
try{ setTheme(localStorage.getItem('ipx.theme')); }catch{ setTheme('dark'); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user