- 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 BLACKBLUEBRIGHT_BLACKBRIGHT_BLUEBRIGHT_CYANBRIGHT_GREENBRIGHT_MAGENTABRIGHT_REDBRIGHT_WHITEBRIGHT_YELLOWCYANGREENMAGENTAREDWHITEYELLOW
-
Field Summary
Fields Modifier and Type Field Description private booleanhighIntensityprivate intindexprivate java.lang.Stringname
-
Constructor Summary
Constructors Modifier Constructor Description privateBasicColor(int index, java.lang.String name)privateBasicColor(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.StringgetAnsiBackgroundControlCode()Gets the ANSI control code for setting the background colourprivate java.lang.StringgetAnsiControlCode(int base)java.lang.StringgetAnsiForegroundControlCode()Gets the ANSI control code for setting the foreground colourjava.lang.StringtoString()booleanusesExtendedColors()Gets whether extended colours are used as this will affect the ANSI reset sequence that needs to be usedstatic BasicColorvalueOf(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:AnsiColorProviderGets the ANSI control code for setting the foreground colour- Specified by:
getAnsiForegroundControlCodein interfaceAnsiColorProvider- Returns:
- Foreground control code
-
getAnsiBackgroundControlCode
public java.lang.String getAnsiBackgroundControlCode()
Description copied from interface:AnsiColorProviderGets the ANSI control code for setting the background colour- Specified by:
getAnsiBackgroundControlCodein interfaceAnsiColorProvider- Returns:
- Background control code
-
usesExtendedColors
public boolean usesExtendedColors()
Description copied from interface:AnsiColorProviderGets whether extended colours are used as this will affect the ANSI reset sequence that needs to be used- Specified by:
usesExtendedColorsin 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:
toStringin classjava.lang.Enum<BasicColor>
-
-