Skip to content

Conversation

@Duckaet
Copy link

@Duckaet Duckaet commented Sep 14, 2025

Problem

The theme reset button currently shows whenever any theme override is active, even when clicking it would produce no visible change.
For example:

  • System preference: Light theme
  • Website override: Light theme
  • Reset button: Shows but clicking does nothing (already matches system)

This creates a confusing user experience where the button appears functional but provides no feedback.

Solution

  • Show reset button when override differs from system preference
  • Hide reset button when override matches system preference or no override exists

i removed the visiblity rules from scss file and used clear_theme_visiblity() function to implement the visblity logic

Before/After Behavior

System Theme Website Override Before After Result
Light Dark Shows ✅ Shows Clear visual feedback
Dark Light Shows ✅ Shows Clear visual feedback
Light Light Shows ❌ Hidden No confusing "broken" button
Dark Dark Shows ❌ Hidden No confusing "broken" button
Any None Hidden ❌ Hidden Consistent behavior

const showReset = currentTheme && (
(currentTheme === "dark" && !systemPrefersDark) ||
(currentTheme === "light" && systemPrefersDark)
);
Copy link
Contributor

@bjorn3 bjorn3 Sep 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the reset button be shown whenever localStorage.getItem("theme") is defined? Even if the currently set theme matches the system color scheme, you should probably still be able to clear the theme such that when you change the system color scheme this website follows rather than keeps the stored color theme.

Edit: That is actually what you are trying to avoid according to the PR description. I personally don't agree that the button should be hidden in this case, but phil-opp will have to decide which of the two behaviors they prefer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it totally depends on him, the button feels broken from my perspective

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants