Enum TerminalTheme
- All Implemented Interfaces:
Serializable, Comparable<TerminalTheme>
Terminal background theme: dark, light, or unknown.
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic TerminalThemefromGrayscale(int gray) Determine theme from a grayscale value.static TerminalThemefromRGB(int red, int green, int blue) Determine theme from RGB background color values.booleanisDark()Returns true if this theme is dark or unknown.booleanisLight()Returns true if this theme is light.static TerminalThemeReturns the enum constant of this type with the specified name.static TerminalTheme[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
DARK
Dark background theme. -
LIGHT
Light background theme. -
UNKNOWN
Theme could not be determined. Treated as dark for safety.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
isDark
public boolean isDark()Returns true if this theme is dark or unknown.- Returns:
- true for DARK or UNKNOWN
-
isLight
public boolean isLight()Returns true if this theme is light.- Returns:
- true for LIGHT only
-
fromRGB
Determine theme from RGB background color values. Uses the perceived luminance formula (ITU-R BT.601).- Parameters:
red- red component (0-255)green- green component (0-255)blue- blue component (0-255)- Returns:
- LIGHT if luminance > 128, DARK otherwise
-
fromGrayscale
Determine theme from a grayscale value.- Parameters:
gray- grayscale value (0-255, where 0 is black and 255 is white)- Returns:
- LIGHT if gray > 128, DARK otherwise
-