java.lang.Object
org.eclipse.lemminx.extensions.colors.utils.ColorUtils

public class ColorUtils extends Object
Color utilities. Some piece of code comes the vscode CSS language server written in TypeScript which has been translated to Java.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.lsp4j.Color
    Returns the Color instance value from the given text and null otherwise.
    static int
    hexDigit(int charCode)
     
    static org.eclipse.lsp4j.ColorPresentation
    toHexa(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace)
    Returns the Hexa color presentation of the given color and replace range.
    static org.eclipse.lsp4j.ColorPresentation
    toRGB(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace)
    Returns the RGB color presentation of the given color and replace range.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ColorUtils

      public ColorUtils()
  • Method Details

    • getColorValue

      public static org.eclipse.lsp4j.Color getColorValue(String text)
      Returns the Color instance value from the given text and null otherwise.
      Parameters:
      text - the color text.
      Returns:
      the Color instance value from the given text and null otherwise.
    • toRGB

      public static org.eclipse.lsp4j.ColorPresentation toRGB(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace)
      Returns the RGB color presentation of the given color and replace range.
      Parameters:
      color - the color.
      replace - the replace range.
      Returns:
      the RGB color presentation of the given color and range.
    • toHexa

      public static org.eclipse.lsp4j.ColorPresentation toHexa(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace)
      Returns the Hexa color presentation of the given color and replace range.
      Parameters:
      color - the color.
      replace - the replace range.
      Returns:
      the Hexa color presentation of the given color and range.
    • hexDigit

      public static int hexDigit(int charCode)