# Dark mode arrives in Gladys 4.63 🌔

**URL:** <https://community.gladysassistant.com/t/le-mode-sombre-debarque-dans-gladys-4-63/9726>\
**Category:** Actualités\
**Created:** [September 29, 2025, 12:19pm UTC](https://community.gladysassistant.com/t/le-mode-sombre-debarque-dans-gladys-4-63/9726 "2025-09-29T12:19:35Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [July 6, 2026, 7:46am UTC](https://community.gladysassistant.com/t/le-mode-sombre-debarque-dans-gladys-4-63/9726/21 "2026-07-06T07:46:34Z")

</div>

I had launched Cursor Agent on the topic which found the same conclusions, corrected in this PR:

> <https://github.com/GladysAssistant/Gladys/pull/2609>
>
> \### Pull Request check-list
> 
> \- \[x\] Is the linter passing? (\`npm run eslint\` on c…hanged front files)
> \- \[x\] Did you run prettier? (\`npm run prettier\` on changed front files)
> \- \[\] If your changes affect the code, did you write the tests?
> \- \[\] Are tests passing? (\`npm test\` on both front/server)
> \- \[\] Did you test this pull request in real life? With real devices?
> 
> \### Description of change
> 
> Fixes intermittent dark mode on iOS / Gladys Plus reported in community feedback.
> 
> \*\*Root cause:\*\* Since dark mode was added (#2343), the app listens to \`prefers-color-scheme\` changes and calls \`updateDarkModeFromSystem()\`, which always overwrites \`localStorage\` with the OS value — even after the user manually toggled light/dark mode.
> 
> On iOS Safari and PWAs, WebKit can fire spurious \`prefers-color-scheme\` change events (e.g. when resuming the app from background). This explains why a user with iOS permanently in light mode still sees dark mode more than half the time, while Firefox on macOS behaves correctly.
> 
> \*\*Fix:\*\*
> \- Introduce an explicit preference model: \`light\`, \`dark\`, or \`system\` (\`front/src/utils/darkModePreference.js\`)
> \- Manual toggle saves an explicit \`light\` / \`dark\` preference that is no longer overwritten by OS events
> \- System preference is only followed when the user has not chosen a mode (\`system\`)
> \- Migrate the legacy \`dark-mode\` localStorage key for backward compatibility
> 
> \*\*Note for affected users:\*\* After this fix ships, toggling once to light mode will persist correctly across sessions.
> 
> 
> \<div\>\<a href="https://cursor.com/agents/bc-019f28d2-0c6b-77d8-a9cd-50f7564a98ca"\>\<picture\>\<source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"\>\<source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"\>\<img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"\>\</picture\>\</a\>&nbsp;\<a href="https://cursor.com/background-agent?bcId=bc-019f28d2-0c6b-77d8-a9cd-50f7564a98ca"\>\<picture\>\<source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"\>\<source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"\>\<img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"\>\</picture\>\</a\>&nbsp;\</div\>
> 
> 
> 
> 
> 
> \## Summary by CodeRabbit
> 
> \* \*\*New Features\*\*
> \* Dark mode preferences now persist more reliably and support a cleaner light/dark/system setting flow.
> \* The app now automatically applies the correct theme to the page and updates when system color-scheme settings change.
> 
> \* \*\*Bug Fixes\*\*
> \* Improved handling of saved theme settings, including legacy values, to avoid incorrect dark mode behavior.
> \* Reduced theme toggle inconsistencies by centralizing how the interface updates.

By the way, quite funny, I also noticed the bug this weekend on my iPhone 😃

[Previous page](https://community.gladysassistant.com/t/le-mode-sombre-debarque-dans-gladys-4-63/9726.md?page=1)
