Package jexer.bits
Class Color
- java.lang.Object
-
- jexer.bits.Color
-
public final class Color extends java.lang.ObjectA text cell color.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object rhs)Comparison check.static ColorgetSgrColor(int sgrValue)Public constructor returns one of the static Color instances.intgetValue()Get color value.inthashCode()Hashcode uses all fields in equals().Colorinvert()Invert a color in the same way as (CGA/VGA color XOR 0x7).java.lang.StringtoRgbString()Convert this color to an RGB string.java.lang.StringtoRgbString(boolean bright)Convert this color to an RGB string.java.lang.StringtoString()Make human-readable description of this Color.
-
-
-
Field Detail
-
BLACK
public static final Color BLACK
Black. Bold + black = dark grey
-
RED
public static final Color RED
Red.
-
GREEN
public static final Color GREEN
Green.
-
YELLOW
public static final Color YELLOW
Yellow. Sometimes not-bold yellow is brown.
-
BLUE
public static final Color BLUE
Blue.
-
MAGENTA
public static final Color MAGENTA
Magenta (purple).
-
CYAN
public static final Color CYAN
Cyan (blue-green).
-
WHITE
public static final Color WHITE
White.
-
-
Method Detail
-
getValue
public int getValue()
Get color value. Note that these deliberately match the color values of the ECMA-48 / ANSI X3.64 / VT100-ish SGR function ("ANSI colors").- Returns:
- the value
-
invert
public Color invert()
Invert a color in the same way as (CGA/VGA color XOR 0x7).- Returns:
- the inverted color
-
equals
public boolean equals(java.lang.Object rhs)
Comparison check. All fields must match to return true.- Overrides:
equalsin classjava.lang.Object- Parameters:
rhs- another Color instance- Returns:
- true if all fields are equal
-
hashCode
public int hashCode()
Hashcode uses all fields in equals().- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash
-
toString
public java.lang.String toString()
Make human-readable description of this Color.- Overrides:
toStringin classjava.lang.Object- Returns:
- displayable String "red", "blue", etc.
-
toRgbString
public java.lang.String toRgbString()
Convert this color to an RGB string.- Returns:
- the RGB string
-
toRgbString
public java.lang.String toRgbString(boolean bright)
Convert this color to an RGB string.- Parameters:
bright- if true, return the bright/bold color- Returns:
- the RGB string
-
getSgrColor
public static Color getSgrColor(int sgrValue)
Public constructor returns one of the static Color instances.- Parameters:
sgrValue- a value between 0 and 15, inclusive, representing an ANSI color- Returns:
- Color.RED, Color.BLUE, etc.
-
-