Enum TextColor.ANSI

java.lang.Object
java.lang.Enum<TextColor.ANSI>
com.googlecode.lanterna.TextColor.ANSI
All Implemented Interfaces:
TextColor, Serializable, Comparable<TextColor.ANSI>, java.lang.constant.Constable
Enclosing interface:
TextColor

public static enum TextColor.ANSI extends Enum<TextColor.ANSI> implements TextColor
This class represent classic ANSI colors that are likely to be very compatible with most terminal implementations. It is limited to 8 colors (plus the 'default' color) but as a norm, using bold mode (SGR code) will slightly alter the color, giving it a bit brighter tone, so in total this will give you 16 (+1) colors.

For more information, see http://en.wikipedia.org/wiki/File:Ansi.png

  • Enum Constant Details

  • Field Details

    • bright

      private final boolean bright
    • red

      private final int red
    • green

      private final int green
    • blue

      private final int blue
    • foregroundSGR

      private final byte[] foregroundSGR
    • backgroundSGR

      private final byte[] backgroundSGR
  • Constructor Details

    • ANSI

      private ANSI(int index, int red, int green, int blue)
    • ANSI

      private ANSI(int index, boolean bright, int red, int green, int blue)
  • Method Details

    • values

      public static TextColor.ANSI[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static TextColor.ANSI valueOf(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getForegroundSGRSequence

      public byte[] getForegroundSGRSequence()
      Description copied from interface: TextColor
      Returns the byte sequence in between CSI and character 'm' that is used to enable this color as the foreground color on an ANSI-compatible terminal.
      Specified by:
      getForegroundSGRSequence in interface TextColor
      Returns:
      Byte array out data to output in between of CSI and 'm'
    • getBackgroundSGRSequence

      public byte[] getBackgroundSGRSequence()
      Description copied from interface: TextColor
      Returns the byte sequence in between CSI and character 'm' that is used to enable this color as the background color on an ANSI-compatible terminal.
      Specified by:
      getBackgroundSGRSequence in interface TextColor
      Returns:
      Byte array out data to output in between of CSI and 'm'
    • isBright

      public boolean isBright()
    • getRed

      public int getRed()
      Specified by:
      getRed in interface TextColor
      Returns:
      Red intensity of this color, from 0 to 255
    • getGreen

      public int getGreen()
      Specified by:
      getGreen in interface TextColor
      Returns:
      Green intensity of this color, from 0 to 255
    • getBlue

      public int getBlue()
      Specified by:
      getBlue in interface TextColor
      Returns:
      Blue intensity of this color, from 0 to 255
    • toColor

      public Color toColor()
      Description copied from interface: TextColor
      Converts this color to an AWT color object, assuming a standard VGA palette.
      Specified by:
      toColor in interface TextColor
      Returns:
      TextColor as an AWT Color