public class RGB extends Color
Modifier and Type | Field and Description |
---|---|
static RGB |
BLACK
0, 0, 0
|
static RGB |
BLUE
0, 0, 255
|
static RGB |
CYAN
0, 255, 255
|
static RGB |
DARKGRAY
169, 169, 169
|
static RGB |
GRAY
128, 128, 128
|
static RGB |
GREEN
0, 128, 0
|
static RGB |
LIGHTGRAY
211, 211, 211
|
static RGB |
MAGENTA
255, 0, 255
|
static RGB |
ORANGE
255, 165, 0
|
static RGB |
PINK
252, 192, 203
|
static RGB |
PURPLE
128, 0, 128
|
static RGB |
RED
255, 0, 0
|
static RGB |
WHITE
255, 255, 255
|
static RGB |
YELLOW
255, 255, 0
|
Constructor and Description |
---|
RGB()
Creates an instance of RGB with default values.
|
RGB(HSL hsl)
Creates an RGB instance using the given
HSL color. |
RGB(HSV hsv)
Creates an RGB instance using the given
HSV color. |
RGB(int red,
int green,
int blue)
Creates an RGB instance using the given RGB values.
|
RGB(RGB rgb)
Creates an RGB instance using the given RGB color.
|
RGB(String hex)
Creates an RGB instance using the given hexadecimal string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getBlue()
Get the blue widget of the color, in the range 0..255.
|
String |
getColor()
Returns the literal string of the color.
|
RGB |
getDarker(double factor)
Return a new color that is darker than this color.
|
double |
getGrayScale()
Returns the gray value (0 to 255) of the color.
|
int |
getGreen()
Get the green widget of the color, in the range 0..255.
|
RGB |
getLighter(double factor)
Return a new color that is lighter than this color.
|
int |
getRed()
Get the red widget of the color, in the range 0..255.
|
List<Integer> |
getRGB()
Get the RGB values.
|
int |
hashCode() |
void |
setBlue(int blue)
Sets the blue value of the RGB color
|
void |
setGreen(int green)
Sets the green value of the RGB color
|
void |
setRed(int red)
Sets the red value of the RGB color
|
String |
toString()
Return the color in String format.
|
public static final RGB BLACK
public static final RGB BLUE
public static final RGB CYAN
public static final RGB DARKGRAY
public static final RGB GRAY
public static final RGB GREEN
public static final RGB LIGHTGRAY
public static final RGB MAGENTA
public static final RGB ORANGE
public static final RGB PINK
public static final RGB PURPLE
public static final RGB RED
public static final RGB YELLOW
public static final RGB WHITE
public RGB()
public RGB(HSL hsl)
HSL
color.hsl
- the HSL colorpublic RGB(HSV hsv)
HSV
color.hsv
- the HSV colorpublic RGB(int red, int green, int blue)
red
- the red value (0..255)green
- the green value (0..255)blue
- the blue value (0..255)public RGB(RGB rgb)
rgb
- the RGB colorpublic RGB(String hex)
hex
- supports "#xxx" or "#xxxxxx"public int getBlue()
public String getColor()
Color
public RGB getDarker(double factor)
factor
- Darker factor (0..1), default to 0.2public double getGrayScale()
public int getGreen()
public RGB getLighter(double factor)
factor
- Lighter factor (0..1), default to 0.2public int getRed()
public void setBlue(int blue)
blue
- the blue value of the RGB colorpublic void setGreen(int green)
green
- the green value of the RGB colorpublic void setRed(int red)
red
- the red value of the RGB colorCopyright © 2018. All rights reserved.