Class ThemeUtils

java.lang.Object
io.jmix.flowui.kit.theme.ThemeUtils

public final class ThemeUtils extends Object
Utility class related to theme handling.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The web storage key for which the theme value will be set
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Applies the 'Dark' theme variant for the current UI.
    static void
    applyDarkTheme(com.vaadin.flow.component.UI ui)
    Applies the 'Dark' theme variant for the given UI.
    static void
    Applies the 'Light' theme variant for the current UI.
    static void
    applyLightTheme(com.vaadin.flow.component.UI ui)
    Applies the 'Light' theme variant for the given UI.
    static void
    Applies the 'System' theme variant for the current UI which means that the theme variant will switch between light and dark themes depending on OS setting (via the browsers 'prefers-color-scheme').
    static void
    applySystemTheme(com.vaadin.flow.component.UI ui)
    Applies the 'System' theme variant for the given UI which means that the theme variant will switch between light and dark themes depending on OS setting (via the browsers 'prefers-color-scheme').
    static void
    applyTheme(com.vaadin.flow.component.UI ui, String theme)
    Applies the given theme variant for the given UI.
    static void
    Applies the given theme variant for the current UI.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • THEME_STORAGE_KEY

      public static final String 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 current UI which 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 given UI which 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 current UI.
    • applyLightTheme

      public static void applyLightTheme(com.vaadin.flow.component.UI ui)
      Applies the 'Light' theme variant for the given UI.
      Parameters:
      ui - the UI for which apply the 'Light' theme variant
    • applyDarkTheme

      public static void applyDarkTheme()
      Applies the 'Dark' theme variant for the current UI.
    • applyDarkTheme

      public static void applyDarkTheme(com.vaadin.flow.component.UI ui)
      Applies the 'Dark' theme variant for the given UI.
      Parameters:
      ui - the UI for which apply the 'Dark' theme variant
    • applyTheme

      public static void applyTheme(@Nullable String theme)
      Applies the given theme variant for the current UI.
      Parameters:
      theme - the theme variant to apply, or null to remove the theme variant value from web storage
    • applyTheme

      public static void applyTheme(com.vaadin.flow.component.UI ui, @Nullable String theme)
      Applies the given theme variant for the given UI.
      Parameters:
      ui - the UI for which apply the given theme variant
      theme - the theme variant to apply, or null to remove the theme variant value from web storage