Package org.eclipse.e4.ui.css.core.css2
Class CSS2ColorHelper
java.lang.Object
org.eclipse.e4.ui.css.core.css2.CSS2ColorHelper
CSS2 Color Helper.
- Version:
- 1.0.0
- Author:
- Angelo ZERR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getColorNameFromHexaColor
(String hexaColor) Return the color name (ex : white) from Hexa color (ex : #FFFFFF).static String
getColorStringValue
(RGBColor rgbColor, ICSSValueConverterConfig config) Return color string form w3crgbColor
instance.static String
getHexaColorFromColorName
(String colorName) Return the Hexa color (ex : #FFFFFF) from color name (ex : white).static String
getHexaColorStringValue
(RGBColor rgbColor) Return hexadecimal (ex : #FFFFFF) color string value from w3crgbColor
instance.static RGBColor
getRGBColor
(String value) Return w3cRGBColor
from string value.static String
getRGBColorStringValue
(RGBColor rgbColor) Return rgb (ex : rgb(0,0,0)) color string value from w3crgbColor
instance.static boolean
isColorName
(String value) Return true ifvalue
is color name (ex : white) and false otherwise.
-
Constructor Details
-
CSS2ColorHelper
public CSS2ColorHelper()
-
-
Method Details
-
getRGBColor
Return w3cRGBColor
from string value. Format String value is hexadecimal like #FFFFFF or color name like white.- Parameters:
value
- string representation of color- Returns:
- parsed color
-
getColorStringValue
Return color string form w3crgbColor
instance. The format (Hexa, color name or rgb format) of the color string is managed withconfig
ICSSValueConverterConfig
.- Parameters:
rgbColor
- the color to get string representation forconfig
- optional config to influence string format- Returns:
- string representation of rgbColor
-
getRGBColorStringValue
Return rgb (ex : rgb(0,0,0)) color string value from w3crgbColor
instance.- Parameters:
rgbColor
- the color to get string representation for- Returns:
- rgbColor as rgb(r, g, b) string
-
getHexaColorStringValue
Return hexadecimal (ex : #FFFFFF) color string value from w3crgbColor
instance.- Parameters:
rgbColor
- the color to get string representation for- Returns:
- rgbColor as hexa string
-
getHexaColorFromColorName
Return the Hexa color (ex : #FFFFFF) from color name (ex : white).- Parameters:
colorName
- name of the desired color- Returns:
- hex representation of named color or
null
if unknown color
-
isColorName
Return true ifvalue
is color name (ex : white) and false otherwise.- Parameters:
value
- name of color to check- Returns:
true
if name is a known named color
-
getColorNameFromHexaColor
Return the color name (ex : white) from Hexa color (ex : #FFFFFF).- Parameters:
hexaColor
- hexa color to check for explicit color name- Returns:
- color name if or
null
if color has no name
-