Package org.cyclos.utils
Class ColorHelper
- java.lang.Object
-
- org.cyclos.utils.ColorHelper
-
public class ColorHelper extends Object
Helper class for colors
-
-
Constructor Summary
Constructors Constructor Description ColorHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringformatRGBasHex(int... rgb)Returns the HTML hex code for the given RGB color components, in the format #RRGGBB, or null if the array is null or doesn't contains 3 elementsstatic int[]fromHSVtoRGB(int[] hsv)static int[]fromHSVtoRGB(int h, int s, int v)Converts a color represented by the given HSV values to RGB values.static int[]fromRGB(int rgb)Returns a color from the given number, being the first byte the red value, and the other 2 bytes, green and bluestatic int[]fromRGBtoHSV(int[] rgb)static int[]fromRGBtoHSV(int r, int g, int b)Converts a color represented by the given RGB values to HSV values.static int[]parse(String string)Parses the RGB color from the given stringstatic int[]parseRGB(String rgbString)Returns a color from the given RGB string, in form rgb(R,G,B)static int[]parseRGBfromHex(String hexString)Returns the RGB components from the given hex string, in form #RRGGBBstatic inttoRGB(int[] rgb)Returns an integer with 6 bytes, being them RRGGBB, or -1 if the given array is null or doesn't have 3 elements
-
-
-
Method Detail
-
formatRGBasHex
public static String formatRGBasHex(int... rgb)
Returns the HTML hex code for the given RGB color components, in the format #RRGGBB, or null if the array is null or doesn't contains 3 elements
-
fromHSVtoRGB
public static int[] fromHSVtoRGB(int h, int s, int v)Converts a color represented by the given HSV values to RGB values. R, G and B ranges are [0, 255], H is [0, 360], S and V are [0, 100];
-
fromHSVtoRGB
public static int[] fromHSVtoRGB(int[] hsv)
- See Also:
fromHSVtoRGB(int, int, int)
-
fromRGB
public static int[] fromRGB(int rgb)
Returns a color from the given number, being the first byte the red value, and the other 2 bytes, green and blue
-
fromRGBtoHSV
public static int[] fromRGBtoHSV(int r, int g, int b)Converts a color represented by the given RGB values to HSV values. R, G and B ranges are [0, 255], H is [0, 360], S and V are [0, 100];
-
fromRGBtoHSV
public static int[] fromRGBtoHSV(int[] rgb)
- See Also:
fromRGBtoHSV(int, int, int)
-
parse
public static int[] parse(String string)
Parses the RGB color from the given string
-
parseRGB
public static int[] parseRGB(String rgbString)
Returns a color from the given RGB string, in form rgb(R,G,B)
-
parseRGBfromHex
public static int[] parseRGBfromHex(String hexString)
Returns the RGB components from the given hex string, in form #RRGGBB
-
toRGB
public static int toRGB(int[] rgb)
Returns an integer with 6 bytes, being them RRGGBB, or -1 if the given array is null or doesn't have 3 elements
-
-