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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetColorNameFromHexaColor(String hexaColor) Return the color name (ex : white) from Hexa color (ex : #FFFFFF).static StringgetColorStringValue(RGBColor rgbColor, ICSSValueConverterConfig config) Return color string form w3crgbColorinstance.static StringgetHexaColorFromColorName(String colorName) Return the Hexa color (ex : #FFFFFF) from color name (ex : white).static StringgetHexaColorStringValue(RGBColor rgbColor) Return hexadecimal (ex : #FFFFFF) color string value from w3crgbColorinstance.static RGBColorgetRGBColor(String value) Return w3cRGBColorfrom string value.static StringgetRGBColorStringValue(RGBColor rgbColor) Return rgb (ex : rgb(0,0,0)) color string value from w3crgbColorinstance.static booleanisColorName(String value) Return true ifvalueis color name (ex : white) and false otherwise.
-
Constructor Details
-
CSS2ColorHelper
public CSS2ColorHelper()
-
-
Method Details
-
getRGBColor
Return w3cRGBColorfrom 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 w3crgbColorinstance. The format (Hexa, color name or rgb format) of the color string is managed withconfigICSSValueConverterConfig.- 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 w3crgbColorinstance.- 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 w3crgbColorinstance.- 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
nullif unknown color
-
isColorName
Return true ifvalueis color name (ex : white) and false otherwise.- Parameters:
value- name of color to check- Returns:
trueif 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
nullif color has no name
-