Package com.vaadin.flow.component.page
Enum Class ColorScheme.Value
- All Implemented Interfaces:
Serializable,Comparable<ColorScheme.Value>,Constable
- Enclosing class:
ColorScheme
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDark color scheme only.Supports both light and dark color schemes, with a preference for dark.Light color scheme only.Supports both light and dark color schemes, with a preference for light.Normal/default color scheme.Use the system's preferred color scheme. -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorScheme.ValuefromString(String value) Converts a string to a ColorScheme.Value enum.Gets the theme attribute value.getValue()Gets the CSS color-scheme property value.static ColorScheme.ValueReturns the enum constant of this class with the specified name.static ColorScheme.Value[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
LIGHT
Light color scheme only. The application will use a light theme regardless of system preferences. -
DARK
Dark color scheme only. The application will use a dark theme regardless of system preferences. -
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
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
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">. -
SYSTEM
Use the system's preferred color scheme. Supports both light and dark modes, adapting to operating system or browser preferences. Defaults to light mode when system preference cannot be determined.This provides a more intuitive name than LIGHT_DARK for the common use case of following system preferences. It is functionally equivalent to LIGHT_DARK, both mapping to the CSS value "light dark".
- See Also:
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getValue
Gets the CSS color-scheme property value.- Returns:
- the CSS value 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
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
-