java.lang.Object
org.strassburger.colorlab4j.color.Color
org.strassburger.colorlab4j.color.spaces.XYZColor

public class XYZColor extends Color
Represents a color in the XYZ color space
See Also:
  • Constructor Details

    • XYZColor

      public XYZColor(double x, double y, double z) throws IllegalArgumentException
      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

      public RGBColor toRGB()
      Description copied from class: Color
      Convert the color to RGB
      Specified by:
      toRGB in class Color
      Returns:
      RGB representation of the color
    • toHSL

      public HSLColor toHSL()
      Description copied from class: Color
      Convert the color to HSL
      Specified by:
      toHSL in class Color
      Returns:
      HSL representation of the color
    • toHSV

      public HSVColor toHSV()
      Description copied from class: Color
      Convert the color to HSV
      Specified by:
      toHSV in class Color
      Returns:
      HSV representation of the color
    • toLAB

      public LABColor toLAB()
      Description copied from class: Color
      Convert the color to LAB
      Specified by:
      toLAB in class Color
      Returns:
      LAB representation of the color
    • toXYZ

      public XYZColor toXYZ()
      Description copied from class: Color
      Convert the color to XYZ
      Specified by:
      toXYZ in class Color
      Returns:
      XYZ representation of the color
    • toCssString

      public String toCssString()
      Description copied from class: Color
      Get the CSS representation of the color
      Specified by:
      toCssString in class Color
      Returns:
      CSS representation of the color
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromHex

      public static XYZColor fromHex(String hex) throws IllegalArgumentException
      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