java.lang.Object
org.strassburger.colorlab4j.color.Color
org.strassburger.colorlab4j.color.spaces.HSVColor

public class HSVColor extends Color
Represents a color in the HSV color space
See Also:
  • Constructor Details

    • HSVColor

      public HSVColor(double h, double s, double v) throws IllegalArgumentException
      Parameters:
      h - Hue value (Degrees, 0-360)
      s - Saturation value (Fraction, 0.0-1.0)
      v - Value value (Fraction, 0.0-1.0)
      Throws:
      IllegalArgumentException - If any of the values are out of range
  • Method Details

    • getHue

      public double getHue()
      Get the hue value of the color (Degrees, 0-360)
      Returns:
      Hue value
    • getSaturation

      public double getSaturation()
      Get the saturation value of the color (Fraction, 0.0-1.0)
      Returns:
      Saturation value
    • getValue

      public double getValue()
      Get the value value (bruh) of the color (Fraction, 0.0-1.0)
      Returns:
      Value value
    • toRGB

      public RGBColor toRGB()
      Description copied from class: Color
      Convert the color to RGB
      Specified by:
      toRGB in class Color
      Returns:
      RGB representation of the color
    • toHSL

      public HSLColor toHSL()
      Description copied from class: Color
      Convert the color to HSL
      Specified by:
      toHSL in class Color
      Returns:
      HSL representation of the color
    • toHSV

      public HSVColor toHSV()
      Description copied from class: Color
      Convert the color to HSV
      Specified by:
      toHSV in class Color
      Returns:
      HSV representation of the color
    • toLAB

      public LABColor toLAB()
      Description copied from class: Color
      Convert the color to LAB
      Specified by:
      toLAB in class Color
      Returns:
      LAB representation of the color
    • toXYZ

      public XYZColor toXYZ()
      Description copied from class: Color
      Convert the color to XYZ
      Specified by:
      toXYZ in class Color
      Returns:
      XYZ representation of the color
    • toCssString

      public String toCssString()
      Description copied from class: Color
      Get the CSS representation of the color
      Specified by:
      toCssString in class Color
      Returns:
      CSS representation of the color
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromHex

      public static HSVColor fromHex(String hex) throws IllegalArgumentException
      Get the HSV representation of a color from a hex string
      Parameters:
      hex - Hex representation of the color (e.g. "#ff0000")
      Returns:
      HSV representation of the color
      Throws:
      IllegalArgumentException - If the HEX code is invalid