Package javajs.util

Class CU

java.lang.Object
javajs.util.CU

public class CU extends Object
ColorUtility
  • 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