Class ColorUtils
- 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.
-
-
Constructor Summary
Constructors Constructor Description ColorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.lsp4j.ColorgetColorValue(String text)Returns theColorinstance value from the giventextand null otherwise.static inthexDigit(int charCode)static booleanisHexNumber(String text)static org.eclipse.lsp4j.ColorPresentationtoHexa(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace, boolean addHash)Returns the Hexa color presentation of the givencolorandreplacerange.static org.eclipse.lsp4j.ColorPresentationtoRGB(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace)Returns the RGB color presentation of the givencolorandreplacerange.
-
-
-
Method Detail
-
getColorValue
public static org.eclipse.lsp4j.Color getColorValue(String text)
Returns theColorinstance value from the giventextand null otherwise.- Parameters:
text- the color text.- Returns:
- the
Colorinstance value from the giventextand 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 givencolorandreplacerange.- Parameters:
color- the color.replace- the replace range.- Returns:
- the RGB color presentation of the given
colorandrange.
-
toHexa
public static org.eclipse.lsp4j.ColorPresentation toHexa(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace, boolean addHash)Returns the Hexa color presentation of the givencolorandreplacerange.- Parameters:
color- the color.replace- the replace range.- Returns:
- the Hexa color presentation of the given
colorandrange.
-
hexDigit
public static int hexDigit(int charCode)
-
isHexNumber
public static boolean isHexNumber(String text)
-
-