Enum AnsiEscape
- All Implemented Interfaces:
Serializable
,Comparable<AnsiEscape>
Converts text into ANSI escape sequences.
The names for colors and attributes are standard, but the exact shade/hue/value of colors are not, and depend on the device used to display them.
-
Enum Constant Summary
Enum ConstantDescriptionBlack background color.Blue background color.Bright black background color.Bright blue background color.Bright cyan background color.Bright green background color.Bright magenta background color.Bright red background color.Bright white background color.Bright yellow background color.Cyan background color.Green background color.Magenta background color.Red background color.White background color.Yellow background color.Black foreground color.Blink general attribute.Blue foreground color.Bold general attribute.Deprecated.This attribute sets font-weight as "bold" and doesn't set color brightness.Bright black foreground color.Bright blue foreground color.Bright cyan foreground color.Bright green foreground color.Bright magenta foreground color.Bright red foreground color.Bright white foreground color.Bright yellow foreground color.The Control Sequence Introducer (or Control Sequence Initiator).Cyan foreground color.Default foreground color.Dim general attribute.Black foreground color.Blue foreground color.Bright black foreground color.Bright blue foreground color.Bright cyan foreground color.Bright green foreground color.Bright magenta foreground color.Bright red foreground color.Bright white foreground color.Bright yellow foreground color.Cyan foreground color.Default foreground color.Green foreground color.Magenta foreground color.Red foreground color.White foreground color.Yellow foreground color.Green foreground color.Normal general attribute.Magenta foreground color.Normal general attribute.Red foreground color.Reverse general attribute.Escape separator.Escape suffix.Underline general attribute.White foreground color.Yellow foreground color. -
Method Summary
Modifier and TypeMethodDescriptionCreates a Map from a source array where values are ANSI escape sequences.Creates a Map from a source array where values are ANSI escape sequences.static String
createSequence
(String... names) Creates an ANSI escape sequence from the given AnsiEscape names.getCode()
Gets the escape code.static String
Gets the default style.static AnsiEscape
Returns the enum constant of this type with the specified name.static AnsiEscape[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
CSI
The Control Sequence Introducer (or Control Sequence Initiator).Most sequences are more than two characters and start with the characters ESC and [ (the left bracket).
-
SUFFIX
Escape suffix. -
SEPARATOR
Escape separator. -
NORMAL
Normal general attribute. -
BRIGHT
Deprecated.This attribute sets font-weight as "bold" and doesn't set color brightness. Use BOLD if you need to change font-weight and BRIGHT_* to use a bright color.Bright general attribute. -
BOLD
Bold general attribute. -
DIM
Dim general attribute. -
UNDERLINE
Underline general attribute. -
BLINK
Blink general attribute. -
REVERSE
Reverse general attribute. -
HIDDEN
Normal general attribute. -
BLACK
Black foreground color. -
FG_BLACK
Black foreground color. -
RED
Red foreground color. -
FG_RED
Red foreground color. -
GREEN
Green foreground color. -
FG_GREEN
Green foreground color. -
YELLOW
Yellow foreground color. -
FG_YELLOW
Yellow foreground color. -
BLUE
Blue foreground color. -
FG_BLUE
Blue foreground color. -
MAGENTA
Magenta foreground color. -
FG_MAGENTA
Magenta foreground color. -
CYAN
Cyan foreground color. -
FG_CYAN
Cyan foreground color. -
WHITE
White foreground color. -
FG_WHITE
White foreground color. -
DEFAULT
Default foreground color. -
FG_DEFAULT
Default foreground color. -
BG_BLACK
Black background color. -
BG_RED
Red background color. -
BG_GREEN
Green background color. -
BG_YELLOW
Yellow background color. -
BG_BLUE
Blue background color. -
BG_MAGENTA
Magenta background color. -
BG_CYAN
Cyan background color. -
BG_WHITE
White background color. -
BRIGHT_BLACK
Bright black foreground color. -
FG_BRIGHT_BLACK
Bright black foreground color. -
BRIGHT_RED
Bright red foreground color. -
FG_BRIGHT_RED
Bright red foreground color. -
BRIGHT_GREEN
Bright green foreground color. -
FG_BRIGHT_GREEN
Bright green foreground color. -
BRIGHT_YELLOW
Bright yellow foreground color. -
FG_BRIGHT_YELLOW
Bright yellow foreground color. -
BRIGHT_BLUE
Bright blue foreground color. -
FG_BRIGHT_BLUE
Bright blue foreground color. -
BRIGHT_MAGENTA
Bright magenta foreground color. -
FG_BRIGHT_MAGENTA
Bright magenta foreground color. -
BRIGHT_CYAN
Bright cyan foreground color. -
FG_BRIGHT_CYAN
Bright cyan foreground color. -
BRIGHT_WHITE
Bright white foreground color. -
FG_BRIGHT_WHITE
Bright white foreground color. -
BG_BRIGHT_BLACK
Bright black background color. -
BG_BRIGHT_RED
Bright red background color. -
BG_BRIGHT_GREEN
Bright green background color. -
BG_BRIGHT_YELLOW
Bright yellow background color. -
BG_BRIGHT_BLUE
Bright blue background color. -
BG_BRIGHT_MAGENTA
Bright magenta background color. -
BG_BRIGHT_CYAN
Bright cyan background color. -
BG_BRIGHT_WHITE
Bright white background color.
-
-
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
-
getDefaultStyle
Gets the default style.- Returns:
- the default style
-
getCode
Gets the escape code.- Returns:
- the escape code.
-
createMap
Creates a Map from a source array where values are ANSI escape sequences. The format is:Key1=Value, Key2=Value, ...
For example:ERROR=red bold, WARN=yellow bold, INFO=green, ...
You can use whitespace around the comma and equal sign. The names in values MUST come from the AnsiEscape enum, case is normalized to upper-case internally.- Parameters:
values
- the source string to parse.dontEscapeKeys
- do not escape these keys, leave the values as is in the map- Returns:
- a new map
-
createMap
Creates a Map from a source array where values are ANSI escape sequences. Each array entry must be in the format:Key1 = Value
For example:ERROR=red bold
You can use whitespace around the equal sign and between the value elements. The names in values MUST come from the AnsiEscape enum, case is normalized to upper-case internally.- Parameters:
values
- the source array to parse.dontEscapeKeys
- do not escape these keys, leave the values as is in the map- Returns:
- a new map
-
createSequence
Creates an ANSI escape sequence from the given AnsiEscape names.- Parameters:
names
- AnsiEscape names.- Returns:
- An ANSI escape sequence.
-