diff --git a/CHANGELOG.md b/CHANGELOG.md index 52b998a..47bc064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.20.25] - 2026-04-20 + +### Fixed +- Theme selection no longer reverts to light mode on page reload when "System" is chosen; the init script now correctly resolves the `system` preference to the OS dark/light state instead of treating it as a literal `data-theme` value + ## [0.20.24] - 2026-04-20 ### Added diff --git a/package-lock.json b/package-lock.json index fab6e4b..1521f13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "oikos", - "version": "0.20.24", + "version": "0.20.25", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "oikos", - "version": "0.20.24", + "version": "0.20.25", "license": "MIT", "dependencies": { "bcrypt": "^6.0.0", diff --git a/package.json b/package.json index 460ca00..8ed55d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oikos", - "version": "0.20.24", + "version": "0.20.25", "description": "Self-hosted family planner - calendar, tasks, shopping, meal planning, budget and more. Private, open-source, no subscription.", "main": "server/index.js", "type": "module", diff --git a/public/index.html b/public/index.html index 1765f32..8d2021c 100644 --- a/public/index.html +++ b/public/index.html @@ -47,9 +47,14 @@ (function() { var stored = localStorage.getItem('oikos-theme'); var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; - document.documentElement.setAttribute('data-theme', stored || (prefersDark ? 'dark' : 'light')); + if (stored === 'dark' || stored === 'light') { + document.documentElement.setAttribute('data-theme', stored); + } else { + document.documentElement.setAttribute('data-theme', prefersDark ? 'dark' : 'light'); + } window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function(e) { - if (!localStorage.getItem('oikos-theme')) { + var current = localStorage.getItem('oikos-theme'); + if (!current || current === 'system') { document.documentElement.setAttribute('data-theme', e.matches ? 'dark' : 'light'); } });