Package javajs.util
Class CU
java.lang.Object
javajs.util.CU
ColorUtility
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final P3
colorPtFromInt
(int color, P3 pt) static final P3
colorPtFromString
(String colorName) static int
colorPtToFFRGB
(T3 pt) static int
colorTriadToFFRGB
(float x, float y, float z) static int
getArgbFromString
(String strColor) accepts [xRRGGBB] or [0xRRGGBB] or [0xFFRRGGBB] or #RRGGBB or [red,green,blue] or a valid JavaScript colorstatic P3
Convert HSL (hue/saturation/luninance) values to RGBstatic int
rgb
(int red, int grn, int blu) static P3
Convert RGB values to HSL (hue/saturation/lightness)static String
static int
toFFGGGfromRGB
(int rgb) Return a greyscale rgb value 0-FF using NTSC color lightness algorithmstatic void
toRGB3f
(int c, float[] f) static String
-
Constructor Details
-
CU
public CU()
-
-
Method Details
-
toRGBHexString
-
toCSSString
-
getArgbFromString
accepts [xRRGGBB] or [0xRRGGBB] or [0xFFRRGGBB] or #RRGGBB or [red,green,blue] or a valid JavaScript color- Parameters:
strColor
-- Returns:
- 0 if invalid or integer color
-
colorTriadToFFRGB
public static int colorTriadToFFRGB(float x, float y, float z) -
rgb
public static int rgb(int red, int grn, int blu) -
colorPtFromString
-
colorPtFromInt
-
colorPtToFFRGB
-
toRGB3f
public static void toRGB3f(int c, float[] f) -
toFFGGGfromRGB
public static int toFFGGGfromRGB(int rgb) Return a greyscale rgb value 0-FF using NTSC color lightness algorithmthe alpha component is set to 0xFF. If you want a value in the range 0-255 then invalid input: '&' the result with 0xFF;
- Parameters:
rgb
- the rgb value- Returns:
- a grayscale value in the range 0 - 255 decimal
-
rgbToHSL
Convert RGB values to HSL (hue/saturation/lightness)- Parameters:
rgb
- range 255 255 255doRound
- set to false when just using this for for RGB -- HSL -- HSL' -- RGB' conversion- Returns:
- the HSL as P3 range 360 100 100
-
hslToRGB
Convert HSL (hue/saturation/luninance) values to RGB- Parameters:
hsl
- in the range 360, 100, 100- Returns:
- the RGB as P3 range 0 to 255
-