public class ColorSpec
extends java.lang.Object
This class does not interpret the meaning of the color value.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COLOR_BLINK
Color name constant for BLINK color.
|
static java.lang.String |
COLOR_BOLD
Color name constant for BOLD color.
|
static java.lang.String |
COLOR_INPUT
Color name constant for INPUT color.
|
static java.lang.String |
COLOR_MESSAGES
Color name constant for MESSAGES color.
|
static java.lang.String |
COLOR_NORMAL
Color name constant for NORMAL color.
|
static int |
COLOR_VALUE
COLOR_VALUE definition
|
private static java.lang.String |
colorsPattern
WINDOWS colors abbreviations
|
private java.lang.Object |
colorValue
Color name (String) or index (Integer) definition value
|
private static java.util.Map<java.lang.String,Color> |
globalColorMap
Color mapping table common to all terminals
|
private static int |
index
Color table index used on WINDOWS only
|
private static org.apache.commons.logging.Log |
LOG
Logger
|
private static java.lang.String |
pattern0
BLINK- BRIGHT- fgnd-color bgnd-color
|
private static java.lang.String |
pattern1
BLINK- RVV- UNDERLINE- BRIGHT- fgnd-color
|
private static java.util.Map<java.lang.String,java.util.Map<java.lang.Object,Color>> |
terminalColorMap
Map of terminal color mappings.
|
private static java.util.Map<java.lang.Object,Color> |
windowsColorMap
Color mapping table for Windows colors
|
private static java.util.Map<java.lang.String,java.lang.Integer> |
windowsColors
Map of WINDOWS color names and indexes.
|
Constructor and Description |
---|
ColorSpec(ColorSpec color)
Copy constructor.
|
ColorSpec(int intValue)
Build color specification using integer value.
|
ColorSpec(java.lang.String value)
Main constructor.
|
Modifier and Type | Method and Description |
---|---|
Color |
convert()
Convert color specification into real color.
|
private int |
getStandardColors(java.lang.String colorName)
Check if color is missing or is a standard color NORMAL, INPUT or MESSAGES
If yes return the standard color otherwise -1.
|
private static void |
initLinuxColors()
Init colors for Unix/Linux.
|
private static void |
initWindowsColors()
Initialize Windows color names and indexes.
|
private Color |
makeColor(int attribute,
int fg,
int bg)
Build a Color object.
|
private int |
processAttribute(int attribute,
java.lang.String attr)
Process color attribute.
|
private Color |
processLinuxColor()
Process Unix/Linux colors.
|
private Color |
processWindowsColor()
Process Windows colors.
|
private static final org.apache.commons.logging.Log LOG
public static final int COLOR_VALUE
public static final java.lang.String COLOR_NORMAL
public static final java.lang.String COLOR_INPUT
public static final java.lang.String COLOR_MESSAGES
public static final java.lang.String COLOR_BOLD
public static final java.lang.String COLOR_BLINK
private java.lang.Object colorValue
private static java.util.Map<java.lang.String,Color> globalColorMap
private static java.util.Map<java.lang.String,java.util.Map<java.lang.Object,Color>> terminalColorMap
private static java.util.Map<java.lang.Object,Color> windowsColorMap
private static java.util.Map<java.lang.String,java.lang.Integer> windowsColors
private static java.lang.String colorsPattern
private static java.lang.String pattern0
private static java.lang.String pattern1
private static int index
public ColorSpec(ColorSpec color)
color
- existing color specification to duplicatepublic ColorSpec(java.lang.String value)
value
- color name.public ColorSpec(int intValue)
intValue
- Color number.public Color convert()
private Color processLinuxColor()
private Color processWindowsColor()
private static void initLinuxColors()
private static void initWindowsColors()
private Color makeColor(int attribute, int fg, int bg)
attribute
- Color attributes.fg
- Foreground color index.bg
- Background color index.private int processAttribute(int attribute, java.lang.String attr)
attribute
- Current attributes.attr
- Attribute string.private int getStandardColors(java.lang.String colorName)
colorName
- color name.