Documentation of 'kcl.waterloo.defaults.Colors' Java class
Colors
kcl.waterloo.defaults

Class Colors



  • public class Colors
    extends java.lang.Object
    Colors and color utilities. Defines a set of web colors corresponding to those in JavaFX. See http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html for details. N.B. Future versions of the library are likely to add JavaFX support.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.awt.Color[] getAnalagous(java.awt.Color color)
      getAnalagous returns neigbouring colors i.e.
      static java.awt.Color[] getArcSeries(java.awt.Color color, int n, float theta)
      getArcSeries generates a set of colors of different hue.
      static java.lang.String getColor(java.awt.Color c)
      Returns the name associated with a color (or "" if the color is not recognized).
      static java.awt.Color getColor(int i) 
      static java.awt.Color getColor(java.lang.Integer i) 
      static java.awt.Color[] getColor(java.lang.String... s) 
      static java.awt.Color getColor(java.lang.String s)
      Returns the color specified by a name.
      static java.util.LinkedHashMap<java.lang.String,java.awt.Color> getColors()
      Returns the standard web colors sorted alphabetically by name
      static java.awt.Color getComplement(java.awt.Color color)
      getComplement returns the complement of a color (rotated 180 degrees on the color circle).
      static java.util.LinkedHashMap<java.lang.Integer,java.awt.Color> getDefaultMap() 
      static java.awt.Color[] getLightnessSeries(java.awt.Color color, int n)
      getLightnessSeries generates a set of colors of different lightness.
      static float getLuminance(java.awt.Color color)
      getLuminance returns the luminance as a weighted average of the RGB components.
      static float[] getLuminance(java.awt.Color[] colors) 
      static java.awt.Color[] getMonochromeSeries(java.awt.Color color, int n)
      getMonochrome returns a monochrome series by varying the lightness of the reference color.
      static java.awt.Color[] getMonochromeSeries(java.awt.Color color, int n, double llim)
      getMonochrome returns a monochrome series by varying the lightness of the reference color.
      static java.awt.Color[] getSatSeries(java.awt.Color color, int n) 
      static java.awt.Color[] getSplitComplements(java.awt.Color color)
      getSplitComplements returns the 2 split complements of the input i.e.
      static float getTheta(java.awt.Color c)
      getTheta returns the angle of the color in the color circle
      static java.awt.Color[] getTriads(java.awt.Color color)
      getTriads returns the two triadic complements of the input colors.
      static java.awt.Color HSLtoRGB(float h, float s, float l)
      Convert HSL to RGB
      static java.awt.Color labToRGB(float[] lab) 
      static float[] labToXYZ(float[] xyz)
      Converts CIELab to XYZ Based on source at EasyRGB
      static java.awt.Color[] reverse(java.awt.Color[] in)
      Returns a Color[] in reverse order to the input.
      static void setDefaultMap(java.util.LinkedHashMap<java.lang.Integer,java.awt.Color> aDefaultMap) 
      static java.util.ArrayList<java.awt.Color> sortByHue()
      Returns the standard web colors sorted by hue
      static java.util.ArrayList<java.awt.Color> sortByLightness()
      Returns the standard web colors sorted by lightness
      static java.util.ArrayList<java.awt.Color> sortByLuminance()
      Returns the standard web colors sorted by luminance
      static java.util.ArrayList<java.awt.Color> sortBySaturation()
      Returns the standard web colors sorted by saturation
      static float[] toHSL(java.awt.Color color)
      toHSL converts RGB to HSL Based on source at EasyRGB
      static float[][] toHSL(java.awt.Color[] colors)
      Convert an AWT Color array to hsl values
      static float[] toLab(java.awt.Color color)
      toLab converts RGB to CIELab Based on source at EasyRGB
      static float[][] toLab(java.awt.Color[] colors)
      toLab converts RGB Color[] to CIELab Based on source at EasyRGB
      static float[] toXYZ(java.awt.Color color)
      toXYZ converts RGB to XYZ Based on source at EasyRGB
      static float[][] toXYZ(java.awt.Color[] colors)
      toXYZ converts RGB Color array to XYZ Based on source at http://www.easyrgb.com/index.php?X=MATH&H=18#text18
      static java.awt.Color XYZToRGB(float[] xyz)
      Convert RGB to XYZ.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • sortByHue

        public static java.util.ArrayList<java.awt.Color> sortByHue()
        Returns the standard web colors sorted by hue
        Returns:
        ArrayList
      • sortBySaturation

        public static java.util.ArrayList<java.awt.Color> sortBySaturation()
        Returns the standard web colors sorted by saturation
        Returns:
        ArrayList
      • sortByLightness

        public static java.util.ArrayList<java.awt.Color> sortByLightness()
        Returns the standard web colors sorted by lightness
        Returns:
        ArrayList
      • sortByLuminance

        public static java.util.ArrayList<java.awt.Color> sortByLuminance()
        Returns the standard web colors sorted by luminance
        Returns:
        ArrayList
      • getColors

        public static java.util.LinkedHashMap<java.lang.String,java.awt.Color> getColors()
        Returns the standard web colors sorted alphabetically by name
        Returns:
        ArrayList
      • getColor

        public static java.awt.Color getColor(java.lang.String s)
        Returns the color specified by a name.
        Parameters:
        s - name of the web color
        Returns:
        an AWT Color
      • getColor

        public static java.awt.Color[] getColor(java.lang.String... s)
      • getColor

        public static java.lang.String getColor(java.awt.Color c)
        Returns the name associated with a color (or "" if the color is not recognized).
        Parameters:
        c - AWT Color
        Returns:
        name of the web color or "".
      • getColor

        public static java.awt.Color getColor(int i)
      • getColor

        public static java.awt.Color getColor(java.lang.Integer i)
      • getLuminance

        public static float getLuminance(java.awt.Color color)
        getLuminance returns the luminance as a weighted average of the RGB components.
        Parameters:
        color - an AWT Color value
        Returns:
      • getTheta

        public static float getTheta(java.awt.Color c)
        getTheta returns the angle of the color in the color circle
        Parameters:
        c - an AWT Color value
        Returns:
      • getLuminance

        public static float[] getLuminance(java.awt.Color[] colors)
        Parameters:
        colors - an AWT Color array
        Returns:
      • HSLtoRGB

        public static java.awt.Color HSLtoRGB(float h,
                                              float s,
                                              float l)
        Convert HSL to RGB
        Parameters:
        h - hue
        s - saturation
        l - luminance
        Returns:
        an AWT Color value
      • toHSL

        public static float[] toHSL(java.awt.Color color)
        toHSL converts RGB to HSL Based on source at EasyRGB
        Parameters:
        color - an AWT Color value
        Returns:
        HSL values as a float[]
      • toHSL

        public static float[][] toHSL(java.awt.Color[] colors)
        Convert an AWT Color array to hsl values
        Parameters:
        colors - an AWT Color array
        Returns:
        the hsl values as a float[][]
      • toXYZ

        public static float[] toXYZ(java.awt.Color color)
        toXYZ converts RGB to XYZ Based on source at EasyRGB
        Parameters:
        color -
        Returns:
      • toXYZ

        public static float[][] toXYZ(java.awt.Color[] colors)
        toXYZ converts RGB Color array to XYZ Based on source at http://www.easyrgb.com/index.php?X=MATH&H=18#text18
        Parameters:
        colors - an AWT Color array
        Returns:
        the XYZ color values as a float[][]
      • toLab

        public static float[] toLab(java.awt.Color color)
        toLab converts RGB to CIELab Based on source at EasyRGB
        Parameters:
        color - an AWT Color value
        Returns:
        CIELab values as float[]
      • toLab

        public static float[][] toLab(java.awt.Color[] colors)
        toLab converts RGB Color[] to CIELab Based on source at EasyRGB
        Parameters:
        colors - AWT Color array
        Returns:
        CIELab values as float[][]
      • labToXYZ

        public static float[] labToXYZ(float[] xyz)
        Converts CIELab to XYZ Based on source at EasyRGB
        Parameters:
        xyz - XYZ values
        Returns:
        CIELab values
      • XYZToRGB

        public static java.awt.Color XYZToRGB(float[] xyz)
        Convert RGB to XYZ.
        Parameters:
        xyz - XYZ values
        Returns:
        RGB values
      • labToRGB

        public static java.awt.Color labToRGB(float[] lab)
        Parameters:
        lab - CIELab array
        Returns:
        an AWT Color.
      • getArcSeries

        public static java.awt.Color[] getArcSeries(java.awt.Color color,
                                                    int n,
                                                    float theta)
        getArcSeries generates a set of colors of different hue. Example: colors=getArcSeries(color, n, theta) where color is the central color of a set of n colors that subtend an arc of +/-(theta/2) in the color circle. Theta is specified in degrees and should be 0 to 360.
        Parameters:
        color -
        n -
        theta -
        Returns:
      • getComplement

        public static java.awt.Color getComplement(java.awt.Color color)
        getComplement returns the complement of a color (rotated 180 degrees on the color circle). Example: color=getComplement(color);
        Parameters:
        color - the reference color
        Returns:
        the complement of the reference color
      • getSplitComplements

        public static java.awt.Color[] getSplitComplements(java.awt.Color color)
        getSplitComplements returns the 2 split complements of the input i.e. the colors at +/- 150 degrees. Example: color=getSplitComplements(color);
        Parameters:
        color - an AWT Color
        Returns:
      • getTriads

        public static java.awt.Color[] getTriads(java.awt.Color color)
        getTriads returns the two triadic complements of the input colors. i.e. the colors at +/- 120 degrees. Example: color=getTriads(color);
        Parameters:
        color - an AWT Color
        Returns:
      • getAnalagous

        public static java.awt.Color[] getAnalagous(java.awt.Color color)
        getAnalagous returns neigbouring colors i.e. the colors at +/- 30 degrees. Example: color=getAnalagous(color);
        Parameters:
        color - an AWT Color
        Returns:
      • getMonochromeSeries

        public static java.awt.Color[] getMonochromeSeries(java.awt.Color color,
                                                           int n)
        getMonochrome returns a monochrome series by varying the lightness of the reference color. Example: colors=getMonochrome(color, n)
        Parameters:
        color - an AWT Color
        n -
        Returns:
      • getMonochromeSeries

        public static java.awt.Color[] getMonochromeSeries(java.awt.Color color,
                                                           int n,
                                                           double llim)
        getMonochrome returns a monochrome series by varying the lightness of the reference color. Example: colors=getMonochrome(color, n, llim) where color on input is the starting color and n=number of colors to return. Terminate the series at higher lightness by specifying llim on input where llim/2=proportion of the reference color lightness to use.
        Parameters:
        color - an AWT Color
        n -
        llim -
        Returns:
      • getSatSeries

        public static java.awt.Color[] getSatSeries(java.awt.Color color,
                                                    int n)
        Parameters:
        color - an AWT Color
        n -
        Returns:
      • getLightnessSeries

        public static java.awt.Color[] getLightnessSeries(java.awt.Color color,
                                                          int n)
        getLightnessSeries generates a set of colors of different lightness. Example: colors=getLightnessSeries(color, n) where the output is a set of n colors whose lightness ranges from 0 to 1 but which have the same hue and saturation as the input with the reference color at the centre.
        Parameters:
        color -
        n -
        Returns:
      • reverse

        public static java.awt.Color[] reverse(java.awt.Color[] in)
        Returns a Color[] in reverse order to the input.
        Parameters:
        in - an AWT Color[] to reverse
        Returns:
        the reversed AWT Color[]
      • getDefaultMap

        public static java.util.LinkedHashMap<java.lang.Integer,java.awt.Color> getDefaultMap()
        Returns:
        the defaultMap
      • setDefaultMap

        public static void setDefaultMap(java.util.LinkedHashMap<java.lang.Integer,java.awt.Color> aDefaultMap)
        Parameters:
        aDefaultMap - the defaultMap to set

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.