Open odrotbohm opened 1 year ago
We should already do this. See https://github.com/spring-io/spring-asciidoctor-backends/blob/6ce63903637ea570b62ad33c5761854db6765285/src/main/js/setup/switchtheme.js#L25 and https://github.com/spring-io/spring-asciidoctor-backends/blob/6ce63903637ea570b62ad33c5761854db6765285/src/main/js/setup/switchtheme.js#L50.
The problem might be that the theme has been toggled in the past and saved to local storage.
@odrotbohm What does an incognito window do?
You're right. An incognito window brings up the dark theme on a dark OS. I guess I've clicked on the button just to test the switch at some point. A localStorage.removeItem("theme")
did the trick. Wonder if that could be made a bit more convient to reset? Additional icon next to the switch in case a value is set and a click on it removing the value?
Perhaps we just shouldn't save a local value if it matches the detected one.
It would be nice if the CSS could automatically detect whether to use dark or light mode based on the user theme (via media queries).