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

ThemeService.$theme doesn't update #58

Closed
mruknowme opened this issue Oct 11, 2024 · 13 comments
Closed

ThemeService.$theme doesn't update #58

mruknowme opened this issue Oct 11, 2024 · 13 comments
Labels
enhancement New feature or request

Comments

@mruknowme
Copy link
Contributor

ThemeService.$theme doesn't update when the theme is switched using the switcher component.

@MGREMY
Copy link
Collaborator

MGREMY commented Nov 11, 2024

Hello there,
Is that still the case on the 1.0.0 ? :)

@mruknowme
Copy link
Contributor Author

mruknowme commented Nov 12, 2024

Hi @MGREMY,

thanks for your response. Looks like v1 is a major update with many breaking changes. Looks like in v1:

  • there's no longer ThemeService.$theme available and instead ThemeService.getClasses ?
  • there's no longer theme toggle component available ignore this part, the component is still there

could you please point me in the right direction regarding how to implement theme switching (dark/light) in v1?

Thanks

@mruknowme
Copy link
Contributor Author

To clarify the comment above, what I'd like to know is how to 'subscribe' to theme changes so I can update another third-party component (AgGrid) based on the current theme.

@MGREMY
Copy link
Collaborator

MGREMY commented Nov 14, 2024

Hey

We will have some adjustments to make of dark/light theme, but if you want to add dark/light theme into your application, you just have to add somewhere the DarkThemeToggleComponent ; then when you click on it it will set (or reset) color-theme inside localStorage and add the class dark to the html tag
That's how TailwindCSS works

@MGREMY
Copy link
Collaborator

MGREMY commented Nov 14, 2024

To clarify the comment above, what I'd like to know is how to 'subscribe' to theme changes so I can update another third-party component (AgGrid) based on the current theme.

For now we don't provide a way to subscribe or get the signal of the current theme
It will come soon tho

For now, one solution could be to subscribe to the localStorage's color-theme value, and then update the third party component :)

@mruknowme
Copy link
Contributor Author

Ok, thank you @MGREMY , will use localStorage for now. Will be waiting for the 'official' way Service/Observable/Signal.

@MGREMY
Copy link
Collaborator

MGREMY commented Dec 5, 2024

Hey @mruknowme
So i've done some commits adding a fresh API to get the current theme (also switching it if needed)
You can see the code and give some review on this issue
If you have some feedback, let me know

@mruknowme
Copy link
Contributor Author

Hi @MGREMY, great, thank you! Will check it out in next couple of days when back to the project that uses angular-flowbite and let you know. Keep up the great work! 👍🏼

@MGREMY
Copy link
Collaborator

MGREMY commented Dec 6, 2024

Hi @MGREMY, great, thank you! Will check it out in next couple of days when back to the project that uses angular-flowbite and let you know. Keep up the great work! 👍🏼

It's not released yet tho, it's still on the 1.1.0 branch if you want to see it 🙂

@mruknowme
Copy link
Contributor Author

mruknowme commented Dec 11, 2024

Hi @MGREMY ,

noticed that v1.1.0 was released. Coincidentally, perfect timing for me, moving to the project that uses flowbite-angular today. Will let you know if any issues.

@MGREMY
Copy link
Collaborator

MGREMY commented Dec 11, 2024

Hey @mruknowme,
Ha perfect, I'll wait for your update
Also there is a new page on the documentation that might interest you https://flowbite-angular.com/docs/customize/dark-mode

@MGREMY
Copy link
Collaborator

MGREMY commented Dec 16, 2024

Hey @mruknowme
Any update on this or is this ok for you ?

@MGREMY
Copy link
Collaborator

MGREMY commented Jan 9, 2025

I'm closing this as there's no update

@MGREMY MGREMY closed this as completed Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants