oban-bg/oban

Consider using a localStorage key other than "theme" for dark mode

Closed this issue · 2 comments

Current Behavior

My application uses the localStorage key theme for saving the light/dark mode state. Normally, when unset, it uses the OS/browser preference. I noticed that the theme suddenly did not change with the OS setting any more. Later, I noticed that the application theme was actually following what was set in oban_web.
Looking at the code I saw that oban_web uses the localStorage key theme to save the light/dark preference. As this is exactly what my application uses as well, these do interfere unexpectedly. This could cause even more problems when the app expects other values than light or dark.

Expected Behavior

I suggest that oban_web should use a specific key like oban_web_theme, as theme might be used by the main application.

Another suggestion: an option to undo the preference and use the OS/browser setting again would be nice in oban_web. Currently the theme will not change any more unless clearing the localStorage entry.

I see that the changelog for oban_web 2.10 mention an option to switch back to the OS setting. Well done! I don't know if oban_web 2.10 rc still uses the theme key though.

This is already done! As of Oban Web v2.10 the localStorage options are all prefixed with oban: for namespacing.