Package dev.robocode.tankroyale.botapi
Class Color
java.lang.Object
dev.robocode.tankroyale.botapi.Color
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
static Color
Creates a color from a hex triplet.static Color
fromString
(String str) Creates a color from a string.int
getBlue()
Returns the blue color component of the color.int
getGreen()
Returns the green color component of the color.int
getRed()
Returns the red color component of the color.int
hashCode()
toHex()
Returns the color as a hex triplet of six hexadecimal digits representing an RGB color, e.g.toString()
-
Field Details
-
WHITE
-
SILVER
-
GRAY
-
BLACK
-
RED
-
MAROON
-
YELLOW
-
OLIVE
-
LIME
-
GREEN
-
CYAN
-
TEAL
-
BLUE
-
NAVY
-
FUCHSIA
-
PURPLE
-
ORANGE
-
-
Constructor Details
-
Color
public Color(int red, int green, int blue) Creates a Color from RGB values.- Parameters:
red
- is the red color component of the RGB color in the range [0 - 255]green
- is the green color component of the RGB color in the range [0 - 255]blue
- is the red blue component of the RGB color in the range [0 - 255]- See Also:
-
-
Method Details
-
getRed
public int getRed()Returns the red color component of the color.- Returns:
- the red color component of the RGB color in the range [0 - 255]
-
getGreen
public int getGreen()Returns the green color component of the color.- Returns:
- the green color component of the RGB color in the range [0 - 255]
-
getBlue
public int getBlue()Returns the blue color component of the color.- Returns:
- the blue color component of the RGB color in the range [0 - 255]
-
toHex
Returns the color as a hex triplet of six hexadecimal digits representing an RGB color, e.g. "0099CC".- Returns:
- the color as a hex triplet of six hexadecimal digits representing an RGB color, e.g. "0099CC".
-
fromString
Creates a color from a string. Currently, only numeric RGB values are supported. This method works the same was asfromHex(java.lang.String)
except that is required as hash sign before the hex value. An example of a numeric RGB value is "#09C" or "#0099CC", which both represents the same color.- Parameters:
str
- is a string containing either a three or six hexadecimal RGB values like "#09C" or "#0099CC".- Returns:
- the created Color;
null
if the input parameter isnull
. - See Also:
-
fromHex
Creates a color from a hex triplet. A hex triplet is either three or six hexadecimal digits that represents an RGB Color.
An example of a hex triplet is "09C" or "0099CC", which both represents the same color.- Parameters:
hexTriplet
- is a string containing either a three or six hexadecimal numbers like "09C" or "0099CC".- Returns:
- the created Color.
- See Also:
-
equals
-
equals
-
hashCode
-
toString
-