Package com.itextpdf.kernel.colors
Class WebColors
- All Implemented Interfaces:
-
Serializable
,Cloneable
,Map<String,
int[]>
This class is a HashMap that contains the names of colors as a key and the corresponding RGB color as value. (Source: Wikipedia http://en.wikipedia.org/wiki/Web_colors )
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic float[]
getCMYKArray
(String name) Gives an array of five floats that contain CMYK values and opacity, each value is between 0 and 1.static DeviceCmyk
getCMYKColor
(String name) Gives you a DeviceCmyk based on a name.static float[]
getRGBAColor
(String name) Gives an array of four floats that contain RGBA values, each value is between 0 and 1.static DeviceRgb
getRGBColor
(String name) Gives you a DeviceRgb based on a name.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
NAMES
HashMap containing all the names and corresponding color values.
-
-
Constructor Details
-
WebColors
public WebColors()
-
-
Method Details
-
getRGBColor
Gives you a DeviceRgb based on a name.- Parameters:
-
name
- a name such as black, violet, cornflowerblue or #RGB or #RRGGBB or RGB or RRGGBB or rgb(R,G,B) - Returns:
- the corresponding DeviceRgb object. Never returns null.
-
getCMYKColor
Gives you a DeviceCmyk based on a name.- Parameters:
-
name
- 'device-cmyk(c, m, y, k)' structure - Returns:
- the corresponding DeviceCmyk object. Never returns null.
-
getCMYKArray
Gives an array of five floats that contain CMYK values and opacity, each value is between 0 and 1.- Parameters:
-
name
- 'device-cmyk(c, m, y, k)' structure - Returns:
-
the corresponding array of five floats, or
null
if parsing failed.
-
getRGBAColor
Gives an array of four floats that contain RGBA values, each value is between 0 and 1.- Parameters:
-
name
- a name such as black, violet, cornflowerblue or #RGB or #RRGGBB or RGB or RRGGBB or rgb(R,G,B) or rgb(R,G,B,A) - Returns:
-
the corresponding array of four floats, or
null
if parsing failed.
-