# Class CU

java.lang.Object
javajs.util.CU

public class CU extends Object
ColorUtility

## Constructor Summary

Constructors
Constructor
Description
`CU()`

## Method Summary

Modifier and Type
Method
Description
`static 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 color
`static P3`
`hslToRGB(P3 hsl)`
Convert HSL (hue/saturation/luninance) values to RGB
`static int`
`rgb(int red, int grn, int blu)`
`static P3`
`rgbToHSL(P3 rgb, boolean doRound)`
Convert RGB values to HSL (hue/saturation/lightness)
`static String`
`toCSSString(GenericColor c)`
`static int`
`toFFGGGfromRGB(int rgb)`
Return a greyscale rgb value 0-FF using NTSC color lightness algorithm
`static void`
`toRGB3f(int c, float[] f)`
`static String`
`toRGBHexString(GenericColor c)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CU

public CU()

## Method Details

### toRGBHexString

public static String toRGBHexString(GenericColor c)

### toCSSString

public static String toCSSString(GenericColor c)

### getArgbFromString

public static int getArgbFromString(String strColor)
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

public static final P3 colorPtFromString(String colorName)

### colorPtFromInt

public static final P3 colorPtFromInt(int color, P3 pt)

### colorPtToFFRGB

public static int colorPtToFFRGB(T3 pt)

### 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 algorithm

the 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

public static P3 rgbToHSL(P3 rgb, boolean doRound)
Convert RGB values to HSL (hue/saturation/lightness)

Parameters:
  `rgb` - range 255 255 255
  `doRound` - set to false when just using this for for RGB -- HSL -- HSL' -- RGB' conversion
Returns:
  the HSL as P3 range 360 100 100

### hslToRGB

public static P3 hslToRGB(P3 hsl)
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