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 RGBColor getRGBColor(String value)
      Return w3c RGBColor 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(RGBColor rgbColor)
      Return the hex string representation of the given w3c rgbColor.
      Parameters:
      rgbColor - the color to get a string representation for
      Returns:
      the hex string representation of rgbColor
    • getRGBColorStringValue

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

      public static String getHexaColorStringValue(RGBColor rgbColor)
      Return hexadecimal (ex : #FFFFFF) color string value from w3c rgbColor instance.
      Parameters:
      rgbColor - the color to get string representation for
      Returns:
      rgbColor 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