Class HSLColor
java.lang.Object
org.strassburger.colorlab4j.color.Color
org.strassburger.colorlab4j.color.spaces.HSLColor
Represents a color in the HSL color space
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic HSLColorGet the HSL representation of a color from a hex stringdoublegetHue()Get the hue value of the color (Degrees, 0-360)doubleGet the lightness value of the color (Fraction, 0.0-1.0)doubleGet the saturation value of the color (Fraction, 0.0-1.0)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
-
HSLColor
- Parameters:
h- Hue value (Degrees, 0-360)s- Saturation value (Fraction, 0.0-1.0)l- Lightness value (Fraction, 0.0-1.0)- Throws:
IllegalArgumentException- If any of the values are out of range
-
-
Method Details
-
getHue
public double getHue()Get the hue value of the color (Degrees, 0-360)- Returns:
- Hue value
-
getSaturation
public double getSaturation()Get the saturation value of the color (Fraction, 0.0-1.0)- Returns:
- Saturation value
-
getLightness
public double getLightness()Get the lightness value of the color (Fraction, 0.0-1.0)- Returns:
- Lightness 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 HSL representation of a color from a hex string- Parameters:
hex- Hex representation of the color (e.g. "#ff0000")- Returns:
- HSL representation of the color
- Throws:
IllegalArgumentException- If the HEX code is invalid
-