themesberg / flowbite-angular

Official Angular components built for Flowbite and Tailwind CSS
https://flowbite-angular.com
Other
190 stars 42 forks source link

ThemeService.$theme doesn't update #58

Open mruknowme opened 1 month ago

mruknowme commented 1 month ago

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

MGREMY commented 2 weeks ago

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

mruknowme commented 1 week ago

Hi @MGREMY,

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

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

Thanks

mruknowme commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

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