public class Color
extends java.lang.Object
implements java.io.Externalizable
Modifier and Type | Field and Description |
---|---|
private int |
attribute
Terminal attribute.
|
static Color |
BLINK
Color constant for BLINK color.
|
static Color |
BOLD
Color constant for BOLD color.
|
private int |
color
Terminal color.
|
static Color |
DEFAULT
Default color.
|
static Color |
INPUT
Color constant for INPUT color.
|
static Color |
MESSAGES
Color constant for MESSAGES color.
|
static Color |
NORMAL
Color constant for NORMAL color.
|
Modifier | Constructor and Description |
---|---|
|
Color()
Default constructor.
|
private |
Color(Color other)
Create a copy of existing color.
|
|
Color(int attribute,
int color)
Construct an instance using specified color and attribute.
|
Modifier and Type | Method and Description |
---|---|
int |
attribute()
Get attribute.
|
int |
color()
Get color.
|
private Color |
copy()
Create copy of current color.
|
boolean |
equals(java.lang.Object obj) |
private boolean |
has(int attr)
Check bit in the color properties.
|
boolean |
hasBlink()
Check if BLINK color property is active.
|
boolean |
hasBold()
Check if BOLD color property is active.
|
int |
hashCode() |
boolean |
hasReverse()
Check if REVERSE color property is active.
|
boolean |
hasUnderline()
Check if UNDERLINE color property is active.
|
void |
readExternal(java.io.ObjectInput in) |
private Color |
reset(int attr)
Reset specified bit in the color properties.
|
private Color |
set(int attr)
Set specified bit in the color properties.
|
static ColorPalette |
toBackground(Color color)
Returns the background component of the color value.
|
static int |
toColorValue(ColorPalette foreground,
ColorPalette background)
Creates the color value from the foreground and the background
color components.
|
static ColorPalette |
toForeground(Color color)
Returns the foreground component of the color value.
|
Color |
withBlink()
Create color identical to this one but with active BLINK color property.
|
Color |
withBold()
Create color identical to this one but with active BOLD color property.
|
Color |
withoutBlink()
Create color identical to this one but with inactive BLINK color property.
|
Color |
withoutBold()
Create color identical to this one but with inactive BOLD color property.
|
Color |
withoutReverse()
Create color identical to this one but with inactive REVERSE color property.
|
Color |
withoutUnderline()
Create color identical to this one but with inactive UNDERLINE color
property.
|
Color |
withReverse()
Create color identical to this one but with active REVERSE color property.
|
Color |
withUnderline()
Create color identical to this one but with active UNDERLINE color
property.
|
void |
writeExternal(java.io.ObjectOutput out) |
public static final Color DEFAULT
public static final Color NORMAL
public static final Color INPUT
public static final Color MESSAGES
public static final Color BOLD
public static final Color BLINK
private int color
private int attribute
public Color(int attribute, int color)
toColorValue(ColorPalette, ColorPalette)
.attribute
- Terminal attribute.color
- Terminal color.public Color()
private Color(Color other)
other
- Source color.public int attribute()
public int color()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public boolean hasBlink()
true
if property is active.public boolean hasBold()
true
if property is active.public boolean hasReverse()
true
if property is active.public boolean hasUnderline()
true
if property is active.public Color withBlink()
public Color withBold()
public Color withoutBlink()
public Color withoutBold()
public Color withoutReverse()
public Color withoutUnderline()
public Color withReverse()
public Color withUnderline()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
readExternal
in interface java.io.Externalizable
java.io.IOException
Externalizable.readExternal(java.io.ObjectInput)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
Externalizable.writeExternal(java.io.ObjectOutput)
public static ColorPalette toForeground(Color color)
color
- The Color
instance.ColorPalette
.public static ColorPalette toBackground(Color color)
color
- The Color
instance.ColorPalette
.public static int toColorValue(ColorPalette foreground, ColorPalette background)
foreground
- The foreground color component.background
- The background color component.private Color copy()
private boolean has(int attr)
attr
- Property to check.true
if appropriate bit is set.private Color reset(int attr)
attr
- Property to reset.private Color set(int attr)
attr
- Property to set.