Package rma.text
Class ColorFormatter
java.lang.Object
rma.text.ColorFormatter
This class provides methods for converting colors to and from string
representations. Known colors (those defined as constants in the
Color class) are converted directly to or from symbolic names
such as "green" or "magenta". Other colors are converted to or from RGB
specifications in the format #RRGGBB - a '#' followed by 6 hexadecimal
digits.- See Also:
-
Field Details
-
colorNames
-
colors
-
-
Method Details
-
nameForColor
Get a name for a color. Returns a name for the color, if the color is one of the colors predefined in theColorclass: black, blue, cyan, gray, green, magenta, orange, pink, red, white, or yellow.- Parameters:
c- The color.- Returns:
- The name of the color, or null if
cis not one of the colors listed above. - See Also:
-
colorForName
Get a color for a name. Returns a color for a color name, if the name identifies one of the colors predefined in theColorclass.- Parameters:
name- The name of the color.- Returns:
- The
Colorobject for the given name, or null ifnamedoes not identify one of the colors listed above. - See Also:
-
format
Format a color as a string. Returns a string representation of the given color as either a symbolic name (if the color is one of the colors predefined in theColorclass), or a hex representation of the color in the format #RRGGBB.- Parameters:
color- TheColorto parse.- Returns:
- A string representation of the color.
- See Also:
-
parse
Parse a color representation, returning an appropriateColorobject.- Parameters:
name- The name of the color; one of the strings black, blue, cyan, gray, green, magenta, orange, pink, red, white, yellow, or an RGB color specification of the form #RRGGBB.- Returns:
- An appropriate
Colorobject. - Throws:
kiwi.text.ParsingException- Ifnameis an invalid color representation.ParsingException- See Also:
-