Package ca.cgjennings.layout
Class ForegroundColorStyleFactory
- java.lang.Object
-
- ca.cgjennings.layout.ForegroundColorStyleFactory
-
- All Implemented Interfaces:
ParametricStyleFactory
- Direct Known Subclasses:
BackgroundColorStyleFactory
public class ForegroundColorStyleFactory extends java.lang.Object implements ParametricStyleFactory
Create a text style that colours text according to the value of the parameters. It is parsed similarly to colours in HTML, using a parameter of the form #rrggbb or #aarrggbb (the # is optional).Alternatively, the color may consist of floating point numbers between 0 and 1 that describe hue, saturation, brightness, and (optionally) alpha components as an angle (hue) and ratios, e.g. "180 0.5 0.5 0.5".
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description ForegroundColorStyleFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TextStyle
createStyle(MarkupRenderer renderer, java.lang.String[] parameters)
static ForegroundColorStyleFactory
getShared()
static java.awt.Color
parseColor(java.lang.String[] parameters)
Parse a color value from the tag's parameters.
-
-
-
Method Detail
-
parseColor
public static java.awt.Color parseColor(java.lang.String[] parameters)
Parse a color value from the tag's parameters. Returnsnull
if the parameters cannot be effectively parsed, in which case a style is returned that has no effect.
-
createStyle
public TextStyle createStyle(MarkupRenderer renderer, java.lang.String[] parameters)
- Specified by:
createStyle
in interfaceParametricStyleFactory
-
getShared
public static ForegroundColorStyleFactory getShared()
-
-