Class ColorUtils
java.lang.Object
org.eclipse.lemminx.extensions.colors.utils.ColorUtils
Color utilities.
Some piece of code comes the vscode CSS language server written in TypeScript
which has been translated to Java.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.eclipse.lsp4j.ColorgetColorValue(String text) Returns theColorinstance value from the giventextand null otherwise.static inthexDigit(int charCode) static org.eclipse.lsp4j.ColorPresentationtoHexa(org.eclipse.lsp4j.Color color, org.eclipse.lsp4j.Range replace) 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.
-
Constructor Details
-
ColorUtils
public ColorUtils()
-
-
Method Details
-
getColorValue
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) 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)
-