Class CSS2ColorHelper

java.lang.Object
org.eclipse.e4.ui.css.core.css2.CSS2ColorHelper

public class CSS2ColorHelper extends Object
CSS2 Color Helper.
Version:
1.0.0
Author:
Angelo ZERR
  • Constructor Details

    • CSS2ColorHelper

      public CSS2ColorHelper()
  • Method Details

    • getRGBColor

      public static CssValues.CssColor getRGBColor(String value)
      Return a CssValues.CssColor 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

      public static String getColorStringValue(CssValues.CssColor color)
      Return the hex string representation of the given color.
      Parameters:
      color - the color to get a string representation for
      Returns:
      the hex string representation of color
    • getRGBColorStringValue

      public static String getRGBColorStringValue(CssValues.CssColor color)
      Return rgb (ex : rgb(0,0,0)) color string value from the given color.
      Parameters:
      color - the color to get string representation for
      Returns:
      color as rgb(r, g, b) string
    • getHexaColorStringValue

      public static String getHexaColorStringValue(CssValues.CssColor color)
      Return hexadecimal (ex : #FFFFFF) color string value from the given color.
      Parameters:
      color - the color to get string representation for
      Returns:
      color as hexa string
    • getHexaColorFromColorName

      public static String getHexaColorFromColorName(String colorName)
      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

      public static boolean isColorName(String value)
      Return true if value 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

      public static String getColorNameFromHexaColor(String hexaColor)
      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