public final class ColorHelper
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.awt.Color |
decode(java.lang.String colorHexString)
Decodes the specified color string to an actual
Color instance. |
static java.awt.Color |
decode(java.lang.String colorHexString,
boolean solid) |
static java.lang.String |
encode(java.awt.Color color)
Encodes the specified color to a hexadecimal string representation.
|
static int |
ensureColorValueRange(float value)
Ensures that the specified value lies within the accepted range for Color values (0-255).
|
static int |
ensureColorValueRange(int value)
Ensures that the specified value lies within the accepted range for Color values (0-255).
|
public static java.lang.String encode(java.awt.Color color)
Color.RED = "#ff0000"new Color(255, 0, 0, 200) = "#c8ff0000"color - The color that is encoded.decode(String),
Color,
Color.getRGB(),
Integer.toHexString(int)public static java.awt.Color decode(java.lang.String colorHexString)
Color instance.
The accepted format is:
Color.REDnew Color(255, 0, 0, 200)colorHexString - The hexadecimal encodes color string representation.encode(Color),
Color,
Color.decode(String),
Integer.decode(String)public static java.awt.Color decode(java.lang.String colorHexString,
boolean solid)
public static int ensureColorValueRange(float value)
value - The value to check for.public static int ensureColorValueRange(int value)
value - The value to check for.