- java.lang.Object
-
- java.lang.Enum<BasicColor>
-
- com.github.rvesse.airline.io.colors.BasicColor
-
- All Implemented Interfaces:
AnsiColorProvider
,java.io.Serializable
,java.lang.Comparable<BasicColor>
public enum BasicColor extends java.lang.Enum<BasicColor> implements AnsiColorProvider
The 8 basic ANSI Colours
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BLACK
BLUE
BRIGHT_BLACK
BRIGHT_BLUE
BRIGHT_CYAN
BRIGHT_GREEN
BRIGHT_MAGENTA
BRIGHT_RED
BRIGHT_WHITE
BRIGHT_YELLOW
CYAN
GREEN
MAGENTA
RED
WHITE
YELLOW
-
Field Summary
Fields Modifier and Type Field Description private boolean
highIntensity
private int
index
private java.lang.String
name
-
Constructor Summary
Constructors Modifier Constructor Description private
BasicColor(int index, java.lang.String name)
private
BasicColor(int index, java.lang.String name, boolean highIntensity)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAnsiBackgroundControlCode()
Gets the ANSI control code for setting the background colourprivate java.lang.String
getAnsiControlCode(int base)
java.lang.String
getAnsiForegroundControlCode()
Gets the ANSI control code for setting the foreground colourjava.lang.String
toString()
boolean
usesExtendedColors()
Gets whether extended colours are used as this will affect the ANSI reset sequence that needs to be usedstatic BasicColor
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static BasicColor[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
BLACK
public static final BasicColor BLACK
-
RED
public static final BasicColor RED
-
GREEN
public static final BasicColor GREEN
-
YELLOW
public static final BasicColor YELLOW
-
BLUE
public static final BasicColor BLUE
-
MAGENTA
public static final BasicColor MAGENTA
-
CYAN
public static final BasicColor CYAN
-
WHITE
public static final BasicColor WHITE
-
BRIGHT_BLACK
public static final BasicColor BRIGHT_BLACK
-
BRIGHT_RED
public static final BasicColor BRIGHT_RED
-
BRIGHT_GREEN
public static final BasicColor BRIGHT_GREEN
-
BRIGHT_YELLOW
public static final BasicColor BRIGHT_YELLOW
-
BRIGHT_BLUE
public static final BasicColor BRIGHT_BLUE
-
BRIGHT_MAGENTA
public static final BasicColor BRIGHT_MAGENTA
-
BRIGHT_CYAN
public static final BasicColor BRIGHT_CYAN
-
BRIGHT_WHITE
public static final BasicColor BRIGHT_WHITE
-
-
Method Detail
-
values
public static BasicColor[] 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 (BasicColor c : BasicColor.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BasicColor 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
-
getAnsiForegroundControlCode
public java.lang.String getAnsiForegroundControlCode()
Description copied from interface:AnsiColorProvider
Gets the ANSI control code for setting the foreground colour- Specified by:
getAnsiForegroundControlCode
in interfaceAnsiColorProvider
- Returns:
- Foreground control code
-
getAnsiBackgroundControlCode
public java.lang.String getAnsiBackgroundControlCode()
Description copied from interface:AnsiColorProvider
Gets the ANSI control code for setting the background colour- Specified by:
getAnsiBackgroundControlCode
in interfaceAnsiColorProvider
- Returns:
- Background control code
-
usesExtendedColors
public boolean usesExtendedColors()
Description copied from interface:AnsiColorProvider
Gets whether extended colours are used as this will affect the ANSI reset sequence that needs to be used- Specified by:
usesExtendedColors
in interfaceAnsiColorProvider
- Returns:
- True if extended colours are used, false otherwise
-
getAnsiControlCode
private java.lang.String getAnsiControlCode(int base)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<BasicColor>
-
-