public enum AnsiEscape extends 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 | Method and Description |
---|---|
static Map<String,String> |
createMap(String[] values,
String[] dontEscapeKeys)
Creates a Map from a source array where values are ANSI escape sequences.
|
static Map<String,String> |
createMap(String values,
String[] dontEscapeKeys)
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.
|
String |
getCode()
Gets the escape code.
|
static String |
getDefaultStyle()
Gets the default style.
|
static AnsiEscape |
valueOf(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
public static AnsiEscape[] values()
for (AnsiEscape c : AnsiEscape.values()) System.out.println(c);
public static AnsiEscape valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static String getDefaultStyle()
public static Map<String,String> createMap(String values, 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 Map<String,String> createMap(String[] values, 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 String createSequence(String... names)
names
- AnsiEscape names.Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.