Class LABColor
java.lang.Object
org.strassburger.colorlab4j.color.Color
org.strassburger.colorlab4j.color.spaces.LABColor
Represents a color in the LAB (CIELAB) color space
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic LABColorGet the LAB representation of a color from a hex stringdoublegetA()Get the a value of the color (Red-Green axis) (-128-128)doublegetB()Get the b value of the color (Yellow-Blue axis) (-128-128)doublegetL()Get the lightness value of the color (0-100)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
-
LABColor
- Parameters:
l- Lightness value (0-100)a- a value (-128-128)b- b value (-128-128)- Throws:
IllegalArgumentException- If any of the values are out of range
-
-
Method Details
-
getL
public double getL()Get the lightness value of the color (0-100)- Returns:
- Lightness value
-
getA
public double getA()Get the a value of the color (Red-Green axis) (-128-128)- Returns:
- a value
-
getB
public double getB()Get the b value of the color (Yellow-Blue axis) (-128-128)- Returns:
- b 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 LAB representation of a color from a hex string- Parameters:
hex- Hex representation of the color (e.g. "#ff0000")- Returns:
- LAB representation of the color
- Throws:
IllegalArgumentException- If the HEX code is invalid
-