Package jexer.bits
Class Color
- java.lang.Object
-
- jexer.bits.Color
-
public final class Color extends java.lang.Object
A text cell color.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object rhs)
Comparison check.int
getValue()
Get color value.int
hashCode()
Hashcode uses all fields in equals().Color
invert()
Invert a color in the same way as (CGA/VGA color XOR 0x7).java.lang.String
toRgbString()
Convert this color to an RGB string.java.lang.String
toRgbString(boolean bright)
Convert this color to an RGB string.java.lang.String
toString()
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:
equals
in 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:
hashCode
in classjava.lang.Object
- Returns:
- the hash
-
toString
public java.lang.String toString()
Make human-readable description of this Color.- Overrides:
toString
in 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
-
-