Class CSSHSL

java.lang.Object
com.helger.css.decl.CSSHSL
All Implemented Interfaces:
com.helger.commons.lang.ICloneable<CSSHSL>, ICSSColor, ICSSVersionAware, ICSSWriteable

@NotThreadSafe public class CSSHSL extends Object implements ICSSWriteable, ICSSVersionAware, ICSSColor, com.helger.commons.lang.ICloneable<CSSHSL>
Represents a single HSL color value (hue, saturation, lightness).
Author:
Philip Helger
  • Constructor Details

    • CSSHSL

      public CSSHSL(@Nonnull CSSHSL aOther)
      Copy constructor
      Parameters:
      aOther - The object to copy the data from. May not be null.
    • CSSHSL

      public CSSHSL(int nHue, int nSaturation, int nLightness)
      Constructor
      Parameters:
      nHue - Hue value. Is scaled to the range 0-360
      nSaturation - Saturation value. Is cut to the range 0-100 (percentage)
      nLightness - Lightness value. Is cut to the range 0-100 (percentage)
    • CSSHSL

      public CSSHSL(float fHue, float fSaturation, float fLightness)
      Constructor
      Parameters:
      fHue - Hue value. Is scaled to the range 0-360
      fSaturation - Saturation value. Is cut to the range 0-100 (percentage)
      fLightness - Lightness value. Is cut to the range 0-100 (percentage)
    • CSSHSL

      public CSSHSL(@Nonnull @Nonempty String sHue, @Nonnull @Nonempty String sSaturation, @Nonnull @Nonempty String sLightness)
  • Method Details

    • getHue

      @Nonnull @Nonempty public final String getHue()
      Returns:
      hue part
    • setHue

      @Nonnull public final CSSHSL setHue(@Nonnull @Nonempty String sHue)
    • getSaturation

      @Nonnull @Nonempty public final String getSaturation()
      Returns:
      saturation part
    • setSaturation

      @Nonnull public final CSSHSL setSaturation(@Nonnull @Nonempty String sSaturation)
    • getLightness

      @Nonnull @Nonempty public final String getLightness()
      Returns:
      lightness part
    • setLightness

      @Nonnull public final CSSHSL setLightness(@Nonnull @Nonempty String sLightness)
    • getAsHSLA

      @Nonnull public CSSHSLA getAsHSLA(float fOpacity)
      Convert this value to an HSLA value.
      Parameters:
      fOpacity - Opacity part. Is fitted to a value between 0 and 1.
      Returns:
      This value as HSLA value with the passed opacity. Never null.
      Since:
      3.8.3
    • getAsHSLA

      @Nonnull public CSSHSLA getAsHSLA(@Nonnull @Nonempty String sOpacity)
      Convert this value to an HSLA value.
      Parameters:
      sOpacity - Opacity part. May neither be null nor empty.
      Returns:
      This value as HSLA value with the passed opacity. Never null.
      Since:
      3.8.3
    • getAsString

      @Nonnull @Nonempty public String getAsString()
      Specified by:
      getAsString in interface ICSSColor
      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: ICSSWriteable
      Get the contents of this object as a serialized CSS string for writing to an output.
      Specified by:
      getAsCSSString in interface ICSSWriteable
      Parameters:
      aSettings - The settings to be used to format the output. May not be null.
      nIndentLevel - The current indentation level
      Returns:
      The content of this object as CSS string. Never null.
    • getMinimumCSSVersion

      @Nonnull public ECSSVersion getMinimumCSSVersion()
      Specified by:
      getMinimumCSSVersion in interface ICSSVersionAware
      Returns:
      The minimum CSS version that is required to read or write this artifact. May not be null.
    • getClone

      @Nonnull public CSSHSL getClone()
      Specified by:
      getClone in interface com.helger.commons.lang.ICloneable<CSSHSL>
      Since:
      3.8.3
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object