Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme does not change (is it cached) #179

Closed
i-am-the-slime opened this issue Mar 2, 2025 · 7 comments
Closed

Theme does not change (is it cached) #179

i-am-the-slime opened this issue Mar 2, 2025 · 7 comments
Labels
bug Something isn't working

Comments

@i-am-the-slime
Copy link

Describe the bug
I'm using some dark/light theme hook but the theme always stays whatever it started out as.
Expected behavior
Switch

@i-am-the-slime i-am-the-slime added the bug Something isn't working label Mar 2, 2025
@CarlosNZ
Copy link
Owner

CarlosNZ commented Mar 3, 2025

So you have the theme prop change conditionally depending on the dark/light hook value?

Not sure why that wouldn't work, that's basically what the demo is doing when you switch themes.

What version of the component are you using, and can you share the relevant bit of your code?

@i-am-the-slime
Copy link
Author

You're right, I'm sorry, I just tried again and it just worked. Sorry!!

@CarlosNZ
Copy link
Owner

CarlosNZ commented Mar 6, 2025

You're right, I'm sorry, I just tried again and it just worked. Sorry!!

Nice, glad to hear :)

@i-am-the-slime
Copy link
Author

Actually no, I just thought it worked, because I made the background in my themes transparent. I'll have another look at the demo.

@i-am-the-slime
Copy link
Author

i-am-the-slime commented Mar 6, 2025

The demo is always light mode on my system. Weird.

I see what you mean I can pick it from the select and it works.

@CarlosNZ
Copy link
Owner

CarlosNZ commented Mar 6, 2025

Yeah, the demo doesn't respond to system dark/light mode. But it could.

If you set theme={isDarkMode ? DarkTheme : LightTheme } it should switch accordingly (as long as isDarkMode is a React state value)

@i-am-the-slime
Copy link
Author

This was a bug/problem with HeroUI's useTheme provider. I've made a theme that uses css variables to work around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants