Class RGBColor
java.lang.Object
org.chsrobotics.lib.hardware.ledStrip.RGBColor
Represents a color in Red-Green-Blue space, with methods for manipulating said color.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchangeSaturation(double proportion) Returns a new RGBColor with a modified saturation, or color intensity, from this.booleanInterpolates a new color somewhere between this color and another.toString()
-
Field Details
-
r
public final int r -
g
public final int g -
b
public final int b -
RED
-
GREEN
-
BLUE
-
ORANGE
-
YELLOW
-
INDIGO
-
VIOLET
-
WHITE
-
BLACK
-
-
Constructor Details
-
RGBColor
public RGBColor(int r, int g, int b) Constructs an RGBColor.- Parameters:
r- Red value of the color, in the interval [0,255] (inclusive). If too big or small, changed to the closest valid value.g- Green value of the color, in the interval [0,255] (inclusive). If too big or small, changed to the closest valid value.b- Blue value of the color, in the interval [0,255] (inclusive). If too big or small, changed to the closest value value.
-
-
Method Details
-
smear
Interpolates a new color somewhere between this color and another.- Parameters:
reference- Number in [0,1] (inclusive) indicating where to sample the new color. Smaller values indicate a color closest to this color, larger closer to the other color.other- Other color to smear towards.- Returns:
- A new, interpolated color.
-
changeSaturation
Returns a new RGBColor with a modified saturation, or color intensity, from this.- Parameters:
proportion- The amount to multiply each color value by.- Returns:
- A new RGBColor with modified saturation.
-
equals
-
toString
-