Class Hsb

java.lang.Object
com.oorian.css.color.Hsb

public class Hsb extends Object
Encapsulates the attributes used for setting an HSB color.

HSB is an alternative to RGB for specifying a color. HSB stands for Hue, Saturation, and Brightness, where Hue defines the actual color with a value of 0 to 360. Saturation defines the purity of the color with a value of 0 to 100. And Brightness is defined with a value from 0 (black) to 100 (white).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    Brightness component (0 - 100).
    int
    Hue component (0 - 360).
    int
    Saturation component (0 - 100).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Hsb()
    Creates a default HSB object with HSB = 0, 0, 0.
    Hsb(int h, int s, int b)
    Creates an HSB object with the specified HSB values.
    Hsb(Hsb hsb)
    Copy constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a String representation of this object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • h

      public int h
      Hue component (0 - 360).
    • s

      public int s
      Saturation component (0 - 100).
    • b

      public int b
      Brightness component (0 - 100).
  • Constructor Details

    • Hsb

      public Hsb()
      Creates a default HSB object with HSB = 0, 0, 0.
    • Hsb

      public Hsb(int h, int s, int b)
      Creates an HSB object with the specified HSB values.
      Parameters:
      h - Hue component (0 - 360).
      s - Saturation component (0 - 100).
      b - Brightness component (0 - 100).
    • Hsb

      public Hsb(Hsb hsb)
      Copy constructor.
      Parameters:
      hsb - HSB object to copy.
  • Method Details

    • toString

      public String toString()
      Returns a String representation of this object.
      Overrides:
      toString in class Object
      Returns:
      String representation of this object.