- java.lang.Object
-
- com.googlecode.lanterna.TextColor.RGB
-
- All Implemented Interfaces:
TextColor
,java.io.Serializable
- Enclosing interface:
- TextColor
public static class TextColor.RGB extends java.lang.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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.googlecode.lanterna.TextColor
TextColor.ANSI, TextColor.Factory, TextColor.Indexed, TextColor.RGB
-
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
byte[]
getBackgroundSGRSequence()
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
getBlue()
byte[]
getForegroundSGRSequence()
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
getGreen()
int
getRed()
int
hashCode()
java.awt.Color
toColor()
Converts this color to an AWT color object, assuming a standard VGA palette.java.lang.String
toString()
-
-
-
Constructor Detail
-
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 255g
- Green intensity, from 0 to 255b
- Blue intensity, from 0 to 255
-
-
Method Detail
-
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 interfaceTextColor
- 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 interfaceTextColor
- Returns:
- Byte array out data to output in between of CSI and 'm'
-
getRed
public int getRed()
-
getGreen
public int getGreen()
-
getBlue
public int getBlue()
-
toColor
public java.awt.Color toColor()
Description copied from interface:TextColor
Converts this color to an AWT color object, assuming a standard VGA palette.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-