Package org.aesh.terminal.utils
Enum ColorDepth
- All Implemented Interfaces:
Serializable,Comparable<ColorDepth>,java.lang.constant.Constable
Represents the color depth capability of a terminal.
Terminals can support different levels of color:
NO_COLOR- No color support (monochrome)COLORS_8- 8 basic ANSI colors (SGR 30-37, 40-47)COLORS_16- 16 colors (8 colors + bright variants)COLORS_256- 256 color palette (SGR 38;5;n)TRUE_COLOR- 24-bit true color support (SGR 38;2;r;g;b)
- Author:
- Ståle W. Pedersen
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription16 colors - 8 basic colors plus their bright/bold variants256 color palette support (xterm-256color)8 basic ANSI colors (black, red, green, yellow, blue, magenta, cyan, white)No color support - monochrome terminal24-bit true color support (16 million colors) -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorDepthfromColorCount(int colors) Determine the color depth from the number of supported colors.intGet the maximum number of colors supported at this depth.booleanCheck if this color depth supports at least 16 colorsbooleanCheck if this color depth supports at least 256 colorsbooleanCheck if this color depth supports any colorbooleanCheck if this color depth supports true color (24-bit)static ColorDepthReturns the enum constant of this type with the specified name.static ColorDepth[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NO_COLOR
No color support - monochrome terminal -
COLORS_8
8 basic ANSI colors (black, red, green, yellow, blue, magenta, cyan, white) -
COLORS_16
16 colors - 8 basic colors plus their bright/bold variants -
COLORS_256
256 color palette support (xterm-256color) -
TRUE_COLOR
24-bit true color support (16 million colors)
-
-
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
-
getColorCount
public int getColorCount()Get the maximum number of colors supported at this depth.- Returns:
- the maximum number of colors supported at this depth
-
supports256Colors
public boolean supports256Colors()Check if this color depth supports at least 256 colors- Returns:
- true if 256 colors or more are supported
-
supportsTrueColor
public boolean supportsTrueColor()Check if this color depth supports true color (24-bit)- Returns:
- true if true color is supported
-
supports16Colors
public boolean supports16Colors()Check if this color depth supports at least 16 colors- Returns:
- true if 16 colors or more are supported
-
supportsColor
public boolean supportsColor()Check if this color depth supports any color- Returns:
- true if any color is supported
-
fromColorCount
Determine the color depth from the number of supported colors.- Parameters:
colors- the number of colors reported by the terminal- Returns:
- the corresponding ColorDepth
-