For example i have the original hover theme and the hover-dark theme. I have also added several pie charts to a screen with the default “LIGHT” theme. When i switch the app theme from to hover to hover-dark, i want the pie chart theme to switch to “DARK”. Any idea how i can accomplish this. I have already tried accessing the webConfig.AppWindowTheme to detect the current theme but it doesn’t seem to work.
Hi,
webConfig.AppWindowTheme
returns the default theme defined in the web-app.properties
file.
If you “physically” have two themes helium
and helium-dark
then you need to use the UserSettingsTools
bean:
@Inject
protected UserSettingsTools userSettingsTools;
@Subscribe
public void onInit(InitEvent event) {
String userAppTheme = userSettingsTools.loadAppWindowTheme();
}
If you have different color presets for the helium theme, then you need to use the HeliumThemeVariantsManager
bean and obtain current color mode:
@Inject
private HeliumThemeVariantsManager heliumThemeVariantsManager;
@Subscribe
public void onInit(InitEvent event) {
String userAppThemeMode = heliumThemeVariantsManager.getUserAppThemeMode();
}
Regards,
Gleb
1 Like
Thanks Gleb, that’s exactly what i needed.