Package io.jmix.flowui.kit.theme
Class ThemeUtils
java.lang.Object
io.jmix.flowui.kit.theme.ThemeUtils
Utility class related to theme handling.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe web storage key for which the theme value will be set -
Method Summary
Modifier and TypeMethodDescriptionstatic voidApplies the 'Dark' theme variant for the currentUI.static voidapplyDarkTheme(com.vaadin.flow.component.UI ui) Applies the 'Dark' theme variant for the givenUI.static voidApplies the 'Light' theme variant for the currentUI.static voidapplyLightTheme(com.vaadin.flow.component.UI ui) Applies the 'Light' theme variant for the givenUI.static voidApplies the 'System' theme variant for the currentUIwhich means that the theme variant will switch between light and dark themes depending on OS setting (via the browsers 'prefers-color-scheme').static voidapplySystemTheme(com.vaadin.flow.component.UI ui) Applies the 'System' theme variant for the givenUIwhich means that the theme variant will switch between light and dark themes depending on OS setting (via the browsers 'prefers-color-scheme').static voidapplyTheme(com.vaadin.flow.component.UI ui, String theme) Applies the given theme variant for the givenUI.static voidapplyTheme(String theme) Applies the given theme variant for the currentUI.
-
Field Details
-
THEME_STORAGE_KEY
The web storage key for which the theme value will be set- See Also:
-
-
Method Details
-
applySystemTheme
public static void applySystemTheme()Applies the 'System' theme variant for the currentUIwhich means that the theme variant will switch between light and dark themes depending on OS setting (via the browsers 'prefers-color-scheme'). -
applySystemTheme
public static void applySystemTheme(com.vaadin.flow.component.UI ui) Applies the 'System' theme variant for the givenUIwhich means that the theme variant will switch between light and dark themes depending on OS setting (via the browsers 'prefers-color-scheme').- Parameters:
ui- the UI for which apply the 'System' theme variant
-
applyLightTheme
public static void applyLightTheme()Applies the 'Light' theme variant for the currentUI. -
applyLightTheme
public static void applyLightTheme(com.vaadin.flow.component.UI ui) Applies the 'Light' theme variant for the givenUI.- Parameters:
ui- the UI for which apply the 'Light' theme variant
-
applyDarkTheme
public static void applyDarkTheme()Applies the 'Dark' theme variant for the currentUI. -
applyDarkTheme
public static void applyDarkTheme(com.vaadin.flow.component.UI ui) Applies the 'Dark' theme variant for the givenUI.- Parameters:
ui- the UI for which apply the 'Dark' theme variant
-
applyTheme
Applies the given theme variant for the currentUI.- Parameters:
theme- the theme variant to apply, ornullto remove the theme variant value from web storage
-
applyTheme
Applies the given theme variant for the givenUI.- Parameters:
ui- the UI for which apply the given theme varianttheme- the theme variant to apply, ornullto remove the theme variant value from web storage
-