Enum Class CssColorName

java.lang.Object
java.lang.Enum<CssColorName>
com.webfirmframework.wffweb.css.CssColorName
All Implemented Interfaces:
Serializable, Comparable<CssColorName>, Constable

public enum CssColorName extends Enum<CssColorName>
Since:
1.0.0
  • Enum Constant Details

  • Method Details

    • values

      public static CssColorName[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CssColorName valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getColorName

      public String getColorName()
      Returns:
      the colorName
      Since:
      1.0.0
    • getHex

      public String getHex()
      Returns:
      the hex value of the color, eg: for white it will return #FFFFFF
      Since:
      3.0.1
    • getR

      public int getR()
      Returns:
      r value
      Since:
      3.0.1
    • getG

      public int getG()
      Returns:
      g value
      Since:
      3.0.1
    • getB

      public int getB()
      Returns:
      b value
      Since:
      3.0.1
    • getEnumName

      public String getEnumName()
      Returns:
      the name of this enum.
      Since:
      1.0.0
    • toString

      public String toString()
      Overrides:
      toString in class Enum<CssColorName>
    • isValid

      public static boolean isValid(String colorName)
      checks whether the given given colorName is valid , i.e. whether it can have a corresponding object from it.
      Parameters:
      colorName -
      Returns:
      true if the given cssColorName has a corresponding object.
      Since:
      1.0.0
    • getThis

      public static CssColorName getThis(String colorName)
      gets the corresponding object for the given colorName or null for invalid colorName.
      Parameters:
      colorName - the inbuilt color name as per w3 standard.
      Returns:
      the corresponding object for the given colorName or null for invalid colorName.
      Since:
      1.0.0
    • extractOpacity

      public static float extractOpacity(String hex)
      Extracts opacity from the given hex value.
      Parameters:
      hex - it must start with #
      Returns:
      the opacity value from the given hex. It will also return 1.0 if it doesn't contain alpha value in the given hex value. If the length of hex value is 4 or 7 that means it doesn't contain alpha value in it.
      Since:
      3.0.10