Enum Class ColorScheme.Value

java.lang.Object
java.lang.Enum<ColorScheme.Value>
com.vaadin.flow.component.page.ColorScheme.Value
All Implemented Interfaces:
Serializable, Comparable<ColorScheme.Value>, Constable
Enclosing class:
ColorScheme

public static enum ColorScheme.Value extends Enum<ColorScheme.Value>
Enumeration of supported color scheme values.

These values correspond to the CSS color-scheme property values and control how the browser renders UI elements and how the application responds to system color scheme preferences.

  • Enum Constant Details

    • LIGHT

      public static final ColorScheme.Value LIGHT
      Light color scheme only. The application will use a light theme regardless of system preferences.
    • DARK

      public static final ColorScheme.Value DARK
      Dark color scheme only. The application will use a dark theme regardless of system preferences.
    • LIGHT_DARK

      public static final ColorScheme.Value LIGHT_DARK
      Supports both light and dark color schemes, with a preference for light. The application can adapt to system preferences but defaults to light mode.
    • DARK_LIGHT

      public static final ColorScheme.Value DARK_LIGHT
      Supports both light and dark color schemes, with a preference for dark. The application can adapt to system preferences but defaults to dark mode.
    • NORMAL

      public static final ColorScheme.Value NORMAL
      Normal/default color scheme. Indicates that no specific color scheme preference is set via this API. The actual color scheme used will depend on other factors such as the browser's default behavior, system preferences, or other meta tags like <meta name="color-scheme" content="dark">.
  • Method Details

    • values

      public static ColorScheme.Value[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ColorScheme.Value valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
      Gets the CSS color-scheme property value.
      Returns:
      the CSS value string
    • getThemeValue

      public String getThemeValue()
      Gets the theme attribute value.

      For multi-value color schemes (e.g., "light dark"), this returns the value with spaces replaced by hyphens (e.g., "light-dark") for use in the theme attribute.

      Returns:
      the theme attribute value
    • fromString

      public static ColorScheme.Value fromString(String value)
      Converts a string to a ColorScheme.Value enum.
      Parameters:
      value - the CSS color-scheme value string
      Returns:
      the corresponding enum value, or NORMAL if not recognized