Package jexer.bits

Class 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.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 class java.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 class java.lang.Object
        Returns:
        the hash
      • toString

        public java.lang.String toString()
        Make human-readable description of this Color.
        Overrides:
        toString in class java.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