Class HslaCssValue

    • Constructor Detail

      • HslaCssValue

        public HslaCssValue​()
        The default value is hsla(0, 0%, 0%, 1).
        Since:
        1.0.0
      • HslaCssValue

        public HslaCssValue​(java.lang.String hslCssValue)
        Parameters:
        hslCssValue - eg:- hsla(155, 55%, 75%, 1)
      • HslaCssValue

        public HslaCssValue​(HslaCssValue hslCssValue)
      • HslaCssValue

        public HslaCssValue​(int h,
                            float s,
                            float l,
                            float a)
        Parameters:
        h - hue value. accepts values only from 0 to 360.
        s - saturation value. accepts values only from 0 to 100.
        l - lightness value. accepts values only from 0 to 100.
        a - alpha value. accepts values only from 0 to 1.
    • Method Detail

      • setHsla

        public void setHsla​(java.lang.String hsl)
        Parameters:
        hsl - eg:- hsla(155, 55%, 75%, 1)
        Since:
        1.0.0
      • getH

        public int getH​()
      • setH

        public void setH​(int h)
        Parameters:
        h - the hue value, it should be in between 0 to 360.
        Since:
        1.0.0
      • getS

        public float getS​()
        Returns:
        the saturation value. Its unit is always %.
        Since:
        1.0.0
      • setS

        public void setS​(float s)
        Parameters:
        s - the saturation value, it should be in between 0 to 100.
        Since:
        1.0.0
      • getL

        public float getL​()
        Returns:
        the lightness value. Its unit is always %.
        Since:
        1.0.0
      • getSUnit

        public static CssLengthUnit getSUnit​()
        Returns:
        the unit for saturation s.
        Since:
        1.0.0
      • getLUnit

        public static CssLengthUnit getLUnit​()
        Returns:
        the unit for lightness l.
        Since:
        1.0.0
      • setL

        public void setL​(float l)
        Parameters:
        l - the lightness value, it should be in between 0 to 100.
        Since:
        1.0.0
      • setA

        public void setA​(float a)
        Parameters:
        a - the alpha value, it should be in between 0 to 1.
        Since:
        1.0.0
      • getA

        public float getA​()
        To get the alpha value.
        Returns:
        the a
        Since:
        1.0.0
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object
      • getValue

        public java.lang.String getValue​()
        Returns:
        the print format of these values as a css value.
        Since:
        1.0.0
      • isValid

        public static boolean isValid​(java.lang.String hslString)
        Parameters:
        hslString - eg:- hsla(125, 55%, 75%, 1)
        Returns:
        true if valid and false for invalid.
        Since:
        1.0.0