Package com.helger.css.decl
Class CSSHSLA
- java.lang.Object
-
- com.helger.css.decl.CSSHSLA
-
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<CSSHSLA>,ICSSColor,ICSSVersionAware,ICSSWriteable
@NotThreadSafe public class CSSHSLA extends Object implements ICSSWriteable, ICSSVersionAware, ICSSColor, com.helger.commons.lang.ICloneable<CSSHSLA>
Represents a single HSLA color value (hue, saturation, lightness, opacity).- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description CSSHSLA(float fHue, float fSaturation, float fLightness, float fOpacity)ConstructorCSSHSLA(int nHue, int nSaturation, int nLightness, float fOpacity)ConstructorCSSHSLA(CSSHSLA aOther)Copy constructorCSSHSLA(CSSHSL aOther, float fOpacity)ConstructorCSSHSLA(CSSHSL aOther, String sOpacity)ConstructorCSSHSLA(String sHue, String sSaturation, String sLightness, String sOpacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetAsCSSString(ICSSWriterSettings aSettings, int nIndentLevel)Get the contents of this object as a serialized CSS string for writing to an output.CSSHSLgetAsHSL()StringgetAsString()CSSHSLAgetClone()StringgetHue()StringgetLightness()ECSSVersiongetMinimumCSSVersion()StringgetOpacity()StringgetSaturation()inthashCode()CSSHSLAsetHue(String sHue)CSSHSLAsetLightness(String sLightness)CSSHSLAsetOpacity(String sOpacity)CSSHSLAsetSaturation(String sSaturation)StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.css.ICSSWriteable
getAsCSSString, getAsCSSString
-
-
-
-
Constructor Detail
-
CSSHSLA
public CSSHSLA(@Nonnull CSSHSLA aOther)
Copy constructor- Parameters:
aOther- The object to copy the data from. May not benull.
-
CSSHSLA
public CSSHSLA(@Nonnull CSSHSL aOther, float fOpacity)
Constructor- Parameters:
aOther- The HSL value to use as the basis. May not benull.fOpacity- Opacity part. Is fitted to a value between 0 and 1.- Since:
- 3.8.3
-
CSSHSLA
public CSSHSLA(@Nonnull CSSHSL aOther, @Nonnull @Nonempty String sOpacity)
Constructor- Parameters:
aOther- The HSL value to use as the basis. May not benull.sOpacity- Opacity part. May neither benullnor empty.- Since:
- 3.8.3
-
CSSHSLA
public CSSHSLA(int nHue, int nSaturation, int nLightness, float fOpacity)Constructor- Parameters:
nHue- Hue value. Is scaled to the range 0-360nSaturation- Saturation value. Is cut to the range 0-100 (percentage)nLightness- Lightness value. Is cut to the range 0-100 (percentage)fOpacity- Opacity - is scaled to 0-1
-
CSSHSLA
public CSSHSLA(float fHue, float fSaturation, float fLightness, float fOpacity)Constructor- Parameters:
fHue- Hue value. Is scaled to the range 0-360fSaturation- Saturation value. Is cut to the range 0-100 (percentage)fLightness- Lightness value. Is cut to the range 0-100 (percentage)fOpacity- Opacity - is scaled to 0-1
-
-
Method Detail
-
getAsHSL
@Nonnull public CSSHSL getAsHSL()
- Returns:
- This value as HSL value without the opacity. Never
null. - Since:
- 3.8.3
-
getAsString
@Nonnull @Nonempty public String getAsString()
- Specified by:
getAsStringin interfaceICSSColor- Returns:
- The textual representation of the color.
- Since:
- 3.8.3
-
getAsCSSString
@Nonnull @Nonempty public String getAsCSSString(@Nonnull ICSSWriterSettings aSettings, @Nonnegative int nIndentLevel)
Description copied from interface:ICSSWriteableGet the contents of this object as a serialized CSS string for writing to an output.- Specified by:
getAsCSSStringin interfaceICSSWriteable- Parameters:
aSettings- The settings to be used to format the output. May not benull.nIndentLevel- The current indentation level- Returns:
- The content of this object as CSS string. Never
null.
-
getMinimumCSSVersion
@Nonnull public ECSSVersion getMinimumCSSVersion()
- Specified by:
getMinimumCSSVersionin interfaceICSSVersionAware- Returns:
- The minimum CSS version that is required to read or write this
artifact. May not be
null.
-
getClone
@Nonnull public CSSHSLA getClone()
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<CSSHSLA>- Since:
- 3.8.3
-
-