Class HWBColorValue

All Implemented Interfaces:
CSSColorValue, CSSPrimitiveValue, CSSTypedValue, CSSValue, HWBColorValue, Serializable, Cloneable

public class HWBColorValue extends ColorValue implements HWBColorValue
HWB color value.
See Also:
  • Constructor Details

    • HWBColorValue

      public HWBColorValue()
  • Method Details

    • getColorModel

      public CSSColorValue.ColorModel getColorModel()
      Description copied from interface: CSSColorValue
      Get the color model with which this value was set.
      Specified by:
      getColorModel in interface CSSColorValue
      the color model.
    • getCssText

      public String getCssText()
      Description copied from class: StyleValue
      Get a string representation of the current value.
      Specified by:
      getCssText in interface CSSValue
      getCssText in class ColorValue
      the css text representing the value of this property.
    • getMinifiedCssText

      public String getMinifiedCssText(String propertyValue)
      Description copied from interface: CSSValue
      Gives a minified version of the css text of the property.

      It may be customized for the given property name.

      Specified by:
      getMinifiedCssText in interface CSSValue
      getMinifiedCssText in class ColorValue
      propertyValue - the property name.
      the minified css text.
    • getComponent

      public PrimitiveValue getComponent(int index)
      Description copied from class: ColorValue
      Get the color component at index.

      This method allows to access the color components like if they were indexed. It is convenient to perform common tasks at the components (like when computing values).

      Specified by:
      getComponent in class ColorValue
      index - the index. Index 0 is always the alpha channel.
      the color component, or null if the index is incorrect.
    • setComponent

      public void setComponent(int index, StyleValue component)
      Description copied from class: ColorValue
      Set the color component at index.

      This method allows to access the components regardless of them being formally indexed or not. It is convenient to perform common tasks at the components (like when computing values).

      setComponent in class ColorValue
      index - the index. For colors, index 0 is always the alpha channel. Setting a component at an index that does not exist has no effect.
      component - the new color component. Must be a primitive value (that is, either TYPED or a PROXY).
    • toRGBColor

      public RGBAColor toRGBColor() throws DOMException
      Description copied from interface: CSSTypedValue
      If this value represents a color, get it or transform to a RGB color.

      If the color does not map into the sRGB gamut, it is clamped.

      Specified by:
      toRGBColor in interface CSSTypedValue
      toRGBColor in class TypedValue
      the RGBA color.
      DOMException - INVALID_ACCESS_ERR: if this value can't return a RGB color value (either is not a COLOR or not a typed value).
      NOT_SUPPORTED_ERR: if the conversion needs device color space information to be performed accurately.
    • getColor

      public HWBColor getColor()
      Description copied from interface: HWBColorValue
      Get the HWB color represented by this value.
      Specified by:
      getColor in interface CSSColorValue
      Specified by:
      getColor in interface HWBColorValue
      the HWB color.
    • hashCode

      public int hashCode()
      hashCode in class PrimitiveValue
    • equals

      public boolean equals(Object obj)
      equals in class PrimitiveValue
    • clone

      public HWBColorValue clone()
      Description copied from class: TypedValue
      Creates and returns a copy of this object.

      The object will be the same except for the subproperty flag, that will be disabled in the clone object.

      Specified by:
      clone in interface CSSColorValue
      Specified by:
      clone in interface CSSValue
      Specified by:
      clone in interface HWBColorValue
      Specified by:
      clone in class ColorValue
      a copy of this object.