Class TextColor.RGB

java.lang.Object
com.googlecode.lanterna.TextColor.RGB
All Implemented Interfaces:
TextColor, Serializable
Enclosing interface:
TextColor

public static class TextColor.RGB extends Object implements TextColor
This class can be used to specify a color in 24-bit color space (RGB with 8-bit resolution per color). Please be aware that only a few terminal support 24-bit color control codes, please avoid using this class unless you know all users will have compatible terminals. For details, please see this commit log. Behavior on terminals that don't support these codes is undefined.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.googlecode.lanterna.TextColor

    TextColor.ANSI, TextColor.Factory, TextColor.Indexed, TextColor.RGB
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
     
    private final int
     
    private final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RGB(int r, int g, int b)
    This class can be used to specify a color in 24-bit color space (RGB with 8-bit resolution per color).
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    byte[]
    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.
    int
     
    byte[]
    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.
    int
     
    int
     
    int
     
    Converts this color to an AWT color object, assuming a standard VGA palette.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • red

      private final int red
    • green

      private final int green
    • blue

      private final int blue
  • Constructor Details

    • RGB

      public RGB(int r, int g, int b)
      This class can be used to specify a color in 24-bit color space (RGB with 8-bit resolution per color). Please be aware that only a few terminal support 24-bit color control codes, please avoid using this class unless you know all users will have compatible terminals. For details, please see this commit log. Behavior on terminals that don't support these codes is undefined.
      Parameters:
      r - Red intensity, from 0 to 255
      g - Green intensity, from 0 to 255
      b - Blue intensity, from 0 to 255
  • Method Details

    • 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'
    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object