posit-dev / py-shinyswatch

Bootswatch themes for py-shiny
https://posit-dev.github.io/py-shinyswatch/
MIT License
28 stars 3 forks source link

feat: Save and restore theme picker choice in localStorage #43

Closed gadenbuie closed 5 months ago

gadenbuie commented 5 months ago

Closes #37

We now save the user's last chosen theme in localStorage and report this value along with the initial theme name (from the app dev, i.e. the page theme) on app startup.

When returning to a shinyswatch app in the same browser, the last chosen theme will be selected. There may be a small flicker on page load that we can't avoid: the app loads with the initial page theme that is then replaced almost immediately by the restored theme selection.

https://github.com/posit-dev/py-shinyswatch/assets/5420529/1012665c-b6ef-489c-abbb-79f41e611414