- java.lang.Object
-
- java.lang.Enum<TextColor.ANSI>
-
- com.googlecode.lanterna.TextColor.ANSI
-
- All Implemented Interfaces:
TextColor
,java.io.Serializable
,java.lang.Comparable<TextColor.ANSI>
- Enclosing interface:
- TextColor
public static enum TextColor.ANSI extends java.lang.Enum<TextColor.ANSI> implements TextColor
This class represent classic ANSI colors that are likely to be very compatible with most terminal implementations. It is limited to 8 colors (plus the 'default' color) but as a norm, using bold mode (SGR code) will slightly alter the color, giving it a bit brighter tone, so in total this will give you 16 (+1) colors.For more information, see http://en.wikipedia.org/wiki/File:Ansi.png
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.googlecode.lanterna.TextColor
TextColor.ANSI, TextColor.Factory, TextColor.Indexed, TextColor.RGB
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BLACK
BLACK_BRIGHT
BLUE
BLUE_BRIGHT
CYAN
CYAN_BRIGHT
DEFAULT
GREEN
GREEN_BRIGHT
MAGENTA
MAGENTA_BRIGHT
RED
RED_BRIGHT
WHITE
WHITE_BRIGHT
YELLOW
YELLOW_BRIGHT
-
Field Summary
Fields Modifier and Type Field Description private byte[]
backgroundSGR
private int
blue
private boolean
bright
private byte[]
foregroundSGR
private int
green
private int
red
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getBackgroundSGRSequence()
Returns the byte sequence in between CSI and character 'm' that is used to enable this color as the background color on an ANSI-compatible terminal.int
getBlue()
byte[]
getForegroundSGRSequence()
Returns the byte sequence in between CSI and character 'm' that is used to enable this color as the foreground color on an ANSI-compatible terminal.int
getGreen()
int
getRed()
boolean
isBright()
java.awt.Color
toColor()
Converts this color to an AWT color object, assuming a standard VGA palette.static TextColor.ANSI
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static TextColor.ANSI[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BLACK
public static final TextColor.ANSI BLACK
-
RED
public static final TextColor.ANSI RED
-
GREEN
public static final TextColor.ANSI GREEN
-
YELLOW
public static final TextColor.ANSI YELLOW
-
BLUE
public static final TextColor.ANSI BLUE
-
MAGENTA
public static final TextColor.ANSI MAGENTA
-
CYAN
public static final TextColor.ANSI CYAN
-
WHITE
public static final TextColor.ANSI WHITE
-
DEFAULT
public static final TextColor.ANSI DEFAULT
-
BLACK_BRIGHT
public static final TextColor.ANSI BLACK_BRIGHT
-
RED_BRIGHT
public static final TextColor.ANSI RED_BRIGHT
-
GREEN_BRIGHT
public static final TextColor.ANSI GREEN_BRIGHT
-
YELLOW_BRIGHT
public static final TextColor.ANSI YELLOW_BRIGHT
-
BLUE_BRIGHT
public static final TextColor.ANSI BLUE_BRIGHT
-
MAGENTA_BRIGHT
public static final TextColor.ANSI MAGENTA_BRIGHT
-
CYAN_BRIGHT
public static final TextColor.ANSI CYAN_BRIGHT
-
WHITE_BRIGHT
public static final TextColor.ANSI WHITE_BRIGHT
-
-
Method Detail
-
values
public static TextColor.ANSI[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TextColor.ANSI c : TextColor.ANSI.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TextColor.ANSI valueOf(java.lang.String name)
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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getForegroundSGRSequence
public byte[] getForegroundSGRSequence()
Description copied from interface:TextColor
Returns the byte sequence in between CSI and character 'm' that is used to enable this color as the foreground color on an ANSI-compatible terminal.- Specified by:
getForegroundSGRSequence
in interfaceTextColor
- Returns:
- Byte array out data to output in between of CSI and 'm'
-
getBackgroundSGRSequence
public byte[] getBackgroundSGRSequence()
Description copied from interface:TextColor
Returns the byte sequence in between CSI and character 'm' that is used to enable this color as the background color on an ANSI-compatible terminal.- Specified by:
getBackgroundSGRSequence
in interfaceTextColor
- Returns:
- Byte array out data to output in between of CSI and 'm'
-
isBright
public boolean isBright()
-
getRed
public int getRed()
-
getGreen
public int getGreen()
-
getBlue
public int getBlue()
-
-