public class Color extends Object
Constructor and Description |
---|
Color(Color color,
double alpha)
Constructs a new Color instance with the RGB values of the Color argument
and the alpha transparency of the double argument.
|
Color(int r,
int g,
int b)
Constructs a new Color instance with alpha set fully opaque
|
Color(int r,
int g,
int b,
double alpha)
Constructs a new Color instance
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
double |
getAlpha() |
int |
getB() |
int |
getG() |
int |
getR() |
int |
hashCode() |
static boolean |
isAlphaWithinBounds(double alpha)
Verify that argument is valid value for the alpha channel.
|
static boolean |
isChannelWithinBounds(int channel)
Verify that argument is valid value for the R, G or B channel.
|
static Color |
random()
Constructs and returns a new fully random Color instance.
|
String |
rgba() |
String |
toString() |
public static final Color TRANSPARENT
public static final Color BLACK
public static final Color WHITE
public static final Color RED
public static final Color LIME
public static final Color BLUE
public static final Color YELLOW
public static final Color CYAN
public static final Color MAGENTA
public static final Color SILVER
public static final Color GRAY
public static final Color MAROON
public static final Color OLIVE
public static final Color GREEN
public static final Color PURPLE
public static final Color TEAL
public static final Color NAVY
public static final Color DARK_RED
public static final Color BROWN
public static final Color CRIMSON
public static final Color DARK_SALMON
public static final Color SALMON
public static final Color LIGHT_SALMON
public static final Color ORANGE_RED
public static final Color DARK_ORANGE
public static final Color ORANGE
public static final Color GOLD
public static final Color DARK_KHAKI
public static final Color KHAKI
public static final Color YELLOW_GREEN
public static final Color DARK_OLIVE_GREEN
public static final Color GREEN_YELLOW
public static final Color DARK_GREEN
public static final Color DARK_CYAN
public static final Color LIGHT_CYAN
public static final Color AQUA
public static final Color DARK_TURQUOISE
public static final Color TURQUOISE
public static final Color MEDIUM_TURQUOISE
public static final Color PALE_TURQUOISE
public static final Color AQUA_MARINE
public static final Color LIGHT_BLUE
public static final Color SKY_BLUE
public static final Color LIGHT_SKY_BLUE
public static final Color MIDNIGHT_BLUE
public static final Color DARK_BLUE
public static final Color MEDIUM_BLUE
public static final Color BLUE_VIOLET
public static final Color VIOLET
public static final Color DEEP_PINK
public static final Color HOT_PINK
public static final Color LIGHT_PINK
public static final Color PINK
public static final Color LIGHT_YELLOW
public static final Color CHOCOLATE
public static final Color TAN
public static final Color LINEN
public static final Color LAVENDER
public static final Color AZURE
public static final Color DIM_GRAY
public static final Color DARK_GRAY
public static final Color LIGHT_GRAY
public Color(int r, int g, int b, double alpha)
r
- value for Red color channel. Value between 0 and 255
(inclusive).g
- value for Green color channel. Value between 0 and 255
(inclusive).b
- value for Blue color channel. Value between 0 and 255
(inclusive).alpha
- value for alpha transparency. Value between 0 and 1
(inclusive), with 0 fully transparent and 1 fully opaque.public Color(int r, int g, int b)
r
- value for Red color channel. Value between 0 and 255
(inclusive).g
- value for Green color channel. Value between 0 and 255
(inclusive).b
- value for Blue color channel. Value between 0 and 255
(inclusive).public Color(Color color, double alpha)
public static Color random()
public static boolean isChannelWithinBounds(int channel)
Verify that argument is valid value for the R, G or B channel.
Any integer between 0 and 255 (inclusive) is valid.
channel
- public static boolean isAlphaWithinBounds(double alpha)
Verify that argument is valid value for the alpha channel.
Any double between 0.0d and 1.0d (inclusive) is valid.
alpha
- public int getR()
public int getG()
public int getB()
public double getAlpha()
public String rgba()
Color
, as used for JSON.Copyright © 2017. All rights reserved.