public enum AnsiEscape extends java.lang.Enum<AnsiEscape>
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 and Description |
---|
BG_BLACK
Black background color.
|
BG_BLUE
Blue background color.
|
BG_CYAN
Cyan background color.
|
BG_GREEN
Green background color.
|
BG_MAGENTA
Magenta background color.
|
BG_RED
Red background color.
|
BG_WHITE
White background color.
|
BG_YELLOW
Yellow background color.
|
BLACK
Black foreground color.
|
BLINK
Blink general attribute.
|
BLUE
Blue foreground color.
|
BRIGHT
Bright general attribute.
|
CSI
The Control Sequence Introducer (or Control Sequence Initiator).
|
CYAN
Cyan foreground color.
|
DEFAULT
Default foreground color.
|
DIM
Dim general attribute.
|
FG_BLACK
Black foreground color.
|
FG_BLUE
Blue foreground color.
|
FG_CYAN
Cyan foreground color.
|
FG_DEFAULT
Default foreground color.
|
FG_GREEN
Green foreground color.
|
FG_MAGENTA
Magenta foreground color.
|
FG_RED
Red foreground color.
|
FG_WHITE
White foreground color.
|
FG_YELLOW
Yellow foreground color.
|
GREEN
Green foreground color.
|
HIDDEN
Normal general attribute.
|
MAGENTA
Magenta foreground color.
|
NORMAL
Normal general attribute.
|
RED
Red foreground color.
|
REVERSE
Reverse general attribute.
|
SEPARATOR
Escape separator.
|
SUFFIX
Escape suffix.
|
UNDERLINE
Underline general attribute.
|
WHITE
White foreground color.
|
YELLOW
Yellow foreground color.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
code |
private static java.lang.String |
DEFAULT_STYLE |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
createMap(java.lang.String[] values,
java.lang.String[] dontEscapeKeys)
Creates a Map from a source array where values are ANSI escape sequences.
|
static java.util.Map<java.lang.String,java.lang.String> |
createMap(java.lang.String values,
java.lang.String[] dontEscapeKeys)
Creates a Map from a source array where values are ANSI escape sequences.
|
static java.lang.String |
createSequence(java.lang.String... names)
Creates an ANSI escape sequence from the given AnsiEscape names.
|
java.lang.String |
getCode()
Gets the escape code.
|
static java.lang.String |
getDefaultStyle()
Gets the default style.
|
static AnsiEscape |
valueOf(java.lang.String name)
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.
|
public static final AnsiEscape CSI
Most sequences are more than two characters and start with the characters ESC and [ (the left bracket).
public static final AnsiEscape SUFFIX
public static final AnsiEscape SEPARATOR
public static final AnsiEscape NORMAL
public static final AnsiEscape BRIGHT
public static final AnsiEscape DIM
public static final AnsiEscape UNDERLINE
public static final AnsiEscape BLINK
public static final AnsiEscape REVERSE
public static final AnsiEscape HIDDEN
public static final AnsiEscape BLACK
public static final AnsiEscape FG_BLACK
public static final AnsiEscape RED
public static final AnsiEscape FG_RED
public static final AnsiEscape GREEN
public static final AnsiEscape FG_GREEN
public static final AnsiEscape YELLOW
public static final AnsiEscape FG_YELLOW
public static final AnsiEscape BLUE
public static final AnsiEscape FG_BLUE
public static final AnsiEscape MAGENTA
public static final AnsiEscape FG_MAGENTA
public static final AnsiEscape CYAN
public static final AnsiEscape FG_CYAN
public static final AnsiEscape WHITE
public static final AnsiEscape FG_WHITE
public static final AnsiEscape DEFAULT
public static final AnsiEscape FG_DEFAULT
public static final AnsiEscape BG_BLACK
public static final AnsiEscape BG_RED
public static final AnsiEscape BG_GREEN
public static final AnsiEscape BG_YELLOW
public static final AnsiEscape BG_BLUE
public static final AnsiEscape BG_MAGENTA
public static final AnsiEscape BG_CYAN
public static final AnsiEscape BG_WHITE
private static final java.lang.String DEFAULT_STYLE
private final java.lang.String code
public static AnsiEscape[] values()
for (AnsiEscape c : AnsiEscape.values()) System.out.println(c);
public static AnsiEscape valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static java.lang.String getDefaultStyle()
public java.lang.String getCode()
public static java.util.Map<java.lang.String,java.lang.String> createMap(java.lang.String values, java.lang.String[] dontEscapeKeys)
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.
values
- the source string to parse.dontEscapeKeys
- do not escape these keys, leave the values as is in the mappublic static java.util.Map<java.lang.String,java.lang.String> createMap(java.lang.String[] values, java.lang.String[] dontEscapeKeys)
Key1 = ValueFor example:
ERROR=red boldYou 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.
values
- the source array to parse.dontEscapeKeys
- do not escape these keys, leave the values as is in the mappublic static java.lang.String createSequence(java.lang.String... names)
names
- AnsiEscape names.