Class XYZColor
java.lang.Object
org.strassburger.colorlab4j.color.Color
org.strassburger.colorlab4j.color.spaces.XYZColor
Represents a color in the XYZ color space
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic XYZColorGet the XYZ representation of a color from a hex stringdoublegetX()Get the X value of the color (Long-wavelength sensitive cones) (0.0-95.047)doublegetY()Get the Y value of the color (Luminance) (0.0-100.0)doublegetZ()Get the Z value of the color (Short-wavelength sensitive cones) (0.0-108.883)inthashCode()Get the CSS representation of the colortoHSL()Convert the color to HSLtoHSV()Convert the color to HSVtoLAB()Convert the color to LABtoRGB()Convert the color to RGBtoString()toXYZ()Convert the color to XYZ
-
Constructor Details
-
XYZColor
- Parameters:
x- X value (0.0-95.047)y- Y value (0.0-100.0)z- Z value (0.0-108.883)- Throws:
IllegalArgumentException- If any of the values are out of range
-
-
Method Details
-
getX
public double getX()Get the X value of the color (Long-wavelength sensitive cones) (0.0-95.047)- Returns:
- X value
-
getY
public double getY()Get the Y value of the color (Luminance) (0.0-100.0)- Returns:
- Y value
-
getZ
public double getZ()Get the Z value of the color (Short-wavelength sensitive cones) (0.0-108.883)- Returns:
- Z value
-
toRGB
Description copied from class:ColorConvert the color to RGB -
toHSL
Description copied from class:ColorConvert the color to HSL -
toHSV
Description copied from class:ColorConvert the color to HSV -
toLAB
Description copied from class:ColorConvert the color to LAB -
toXYZ
Description copied from class:ColorConvert the color to XYZ -
toCssString
Description copied from class:ColorGet the CSS representation of the color- Specified by:
toCssStringin classColor- Returns:
- CSS representation of the color
-
toString
-
hashCode
public int hashCode() -
equals
-
fromHex
Get the XYZ representation of a color from a hex string- Parameters:
hex- Hex representation of the color (e.g. "#ff0000")- Returns:
- XYZ representation of the color
- Throws:
IllegalArgumentException- If the HEX code is invalid
-