public class CSColor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static CSColor |
BLACK |
static CSColor |
BLUE |
static CSColor |
CYAN |
static CSColor |
GREEN |
static CSColor |
MAGENTA |
static CSColor |
RED |
static CSColor |
WHITE |
static CSColor |
YELLOW |
Constructor and Description |
---|
CSColor(int redComponent,
int greenComponent,
int blueComponent)
This constructor creates a CSColor object with the specified RGB component
values.
|
Modifier and Type | Method and Description |
---|---|
CSColor |
add(CSColor other)
The method returns a new CSColor value that is the sum of this color and
the other color.
|
CSColor |
brighten()
The method returns a brighter new CSColor value.
|
CSColor |
darken()
The method returns a darker new CSColor value.
|
CSColor |
dim()
The method returns a dimmer new CSColor value.
|
boolean |
equals(CSColor other)
This method returns true if this color is equal to the other color and
returns false if it is not equal.
|
CSColor |
lighten()
The method returns a lighter new CSColor value.
|
CSColor |
sub(CSColor other)
The method returns a new CSColor value that is the difference between this
color and the other color.
|
java.lang.String |
toString()
This method returns a string representation of the color in the form
"#RRGGBB" where RR, GG, and BB are the red, green and blue component
values expressed as hexadecimal digits.
|
public static final CSColor BLACK
public static final CSColor RED
public static final CSColor GREEN
public static final CSColor YELLOW
public static final CSColor BLUE
public static final CSColor MAGENTA
public static final CSColor CYAN
public static final CSColor WHITE
public CSColor(int redComponent, int greenComponent, int blueComponent)
redComponent
- The color's red component as a value 0-255greenComponent
- The color's green component as a value 0-255blueComponent
- The color's blue component as a value 0-255public java.lang.String toString()
toString
in class java.lang.Object
public CSColor add(CSColor other)
other
- The color to be added to this colorpublic CSColor sub(CSColor other)
other
- The color to be subtracted from this colorpublic CSColor dim()
public CSColor darken()
public boolean equals(CSColor other)
other
- The color to be compared to this colorpublic CSColor lighten()
public CSColor brighten()