public class Color extends Object
| Constructor and Description |
|---|
Color()
Default color constructor, opaque black
|
Color(float[] hsl)
Create the color with HSL (hue, saturation, lightness) or HSL (alpha)
values
|
Color(float[] hsl,
float alpha)
Create the color with HSLA (hue, saturation, lightness, alpha) values
|
Color(float red,
float green,
float blue)
Create the color with arithmetic RGB values
|
Color(float red,
float green,
float blue,
float opacity)
Create the color with arithmetic RGB values
|
Color(int color)
Create the color as a single integer
|
Color(int red,
int green,
int blue)
Create the color with RGB values
|
Color(int red,
int green,
int blue,
float opacity)
Create the color with RGBA values
|
Color(int red,
int green,
int blue,
int alpha)
Create the color with RGBA values
|
Color(String color)
Create the color in hex
|
Color(String color,
float opacity)
Create the color in hex with an opacity
|
Color(String color,
int alpha)
Create the color in hex with an alpha
|
Color(String red,
String green,
String blue)
Create the color with individual hex colors
|
Color(String red,
String green,
String blue,
float opacity)
Create the color with individual hex colors and opacity
|
Color(String red,
String green,
String blue,
String alpha)
Create the color with individual hex colors and alpha
|
| Modifier and Type | Method and Description |
|---|---|
int |
getAlpha()
Get the alpha color as an integer
|
float |
getAlphaArithmetic()
Get the alpha color as an arithmetic float
|
String |
getAlphaHex()
Get the alpha color in hex
|
String |
getAlphaHexShorthand()
Get the alpha color in hex, shorthand when possible
|
int |
getBlue()
Get the blue color as an integer
|
float |
getBlueArithmetic()
Get the blue color as an arithmetic float
|
String |
getBlueHex()
Get the blue color in hex
|
String |
getBlueHexShorthand()
Get the blue color in hex, shorthand when possible
|
int |
getColor()
Get the color as an integer
|
String |
getColorHex()
Get the color as a hex string
|
String |
getColorHexShorthand()
Get the color as a hex string, shorthanded when possible
|
String |
getColorHexShorthandWithAlpha()
Get the color as a hex string with alpha, shorthanded when possible
|
String |
getColorHexWithAlpha()
Get the color as a hex string with alpha
|
int |
getColorWithAlpha()
Get the color as an integer including the alpha
|
int |
getGreen()
Get the green color as an integer
|
float |
getGreenArithmetic()
Get the green color as an arithmetic float
|
String |
getGreenHex()
Get the green color in hex
|
String |
getGreenHexShorthand()
Get the green color in hex, shorthand when possible
|
float[] |
getHSL()
Get the HSL (hue, saturation, lightness) values
|
float |
getHue()
Get the HSL hue value
|
float |
getLightness()
Get the HSL lightness value
|
float |
getOpacity()
Get the opacity as an arithmetic float
|
int |
getRed()
Get the red color as an integer
|
float |
getRedArithmetic()
Get the red color as an arithmetic float
|
String |
getRedHex()
Get the red color in hex
|
String |
getRedHexShorthand()
Get the red color in hex, shorthand when possible
|
float |
getSaturation()
Get the HSL saturation value
|
boolean |
isOpaque()
Check if the color is opaque (opacity or alpha of 1.0, 255, or x00)
|
void |
setAlpha(float alpha)
Set the alpha color as an arithmetic float
|
void |
setAlpha(int alpha)
Set the alpha color as an integer
|
void |
setAlpha(String alpha)
Set the alpha color in hex
|
void |
setBlue(float blue)
Set the blue color as an arithmetic float
|
void |
setBlue(int blue)
Set the blue color as an integer
|
void |
setBlue(String blue)
Set the blue color in hex
|
void |
setColor(float red,
float green,
float blue)
Set the color with arithmetic RGB values
|
void |
setColor(float red,
float green,
float blue,
float opacity)
Set the color with arithmetic RGB values
|
void |
setColor(int color)
Set the color as a single integer
|
void |
setColor(int red,
int green,
int blue)
Set the color with RGB values
|
void |
setColor(int red,
int green,
int blue,
float opacity)
Set the color with RGBA values
|
void |
setColor(int red,
int green,
int blue,
int alpha)
Set the color with RGBA values
|
void |
setColor(String color)
Set the color in hex
|
void |
setColor(String color,
float opacity)
Set the color in hex with an opacity
|
void |
setColor(String color,
int alpha)
Set the color in hex with an alpha
|
void |
setColor(String red,
String green,
String blue)
Set the color with individual hex colors
|
void |
setColor(String red,
String green,
String blue,
float opacity)
Set the color with individual hex colors and opacity
|
void |
setColor(String red,
String green,
String blue,
String alpha)
Set the color with individual hex colors and alpha
|
void |
setColorByHSL(float hue,
float saturation,
float lightness)
Set the color with HSL (hue, saturation, lightness) values
|
void |
setColorByHSL(float hue,
float saturation,
float lightness,
float alpha)
Set the color with HSLA (hue, saturation, lightness, alpha) values
|
void |
setGreen(float green)
Set the green color as an arithmetic float
|
void |
setGreen(int green)
Set the green color as an integer
|
void |
setGreen(String green)
Set the green color in hex
|
void |
setOpacity(float opacity)
Set the opacity as an arithmetic float
|
void |
setRed(float red)
Set the red color as an arithmetic float
|
void |
setRed(int red)
Set the red color as an integer
|
void |
setRed(String red)
Set the red color in hex
|
public Color()
public Color(String color)
color - hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB,
AARRGGBB, #ARGB, or ARGBpublic Color(String color, float opacity)
color - hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB,
AARRGGBB, #ARGB, or ARGBopacity - opacity float inclusively between 0.0 and 1.0public Color(String color, int alpha)
color - hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB,
AARRGGBB, #ARGB, or ARGBalpha - alpha integer color inclusively between 0 and 255public Color(String red, String green, String blue)
red - red hex color in format RRgreen - green hex color in format GGblue - blue hex color in format BBpublic Color(String red, String green, String blue, String alpha)
red - red hex color in format RRgreen - green hex color in format GGblue - blue hex color in format BBalpha - alpha hex color in format AApublic Color(String red, String green, String blue, float opacity)
red - red hex color in format RRgreen - green hex color in format GGblue - blue hex color in format BBopacity - opacity float inclusively between 0.0 and 1.0public Color(int red,
int green,
int blue)
red - red integer color inclusively between 0 and 255green - green integer color inclusively between 0 and 255blue - blue integer color inclusively between 0 and 255public Color(int red,
int green,
int blue,
int alpha)
red - red integer color inclusively between 0 and 255green - green integer color inclusively between 0 and 255blue - blue integer color inclusively between 0 and 255alpha - alpha integer color inclusively between 0 and 255public Color(int red,
int green,
int blue,
float opacity)
red - red integer color inclusively between 0 and 255green - green integer color inclusively between 0 and 255blue - blue integer color inclusively between 0 and 255opacity - opacity float inclusively between 0.0 and 1.0public Color(float red,
float green,
float blue)
red - red float color inclusively between 0.0 and 1.0green - green float color inclusively between 0.0 and 1.0blue - blue float color inclusively between 0.0 and 1.0public Color(float red,
float green,
float blue,
float opacity)
red - red float color inclusively between 0.0 and 1.0green - green float color inclusively between 0.0 and 1.0blue - blue float color inclusively between 0.0 and 1.0opacity - opacity float inclusively between 0.0 and 1.0public Color(float[] hsl)
hsl - HSL array where: 0 = hue, 1 = saturation, 2 = lightness,
optional 3 = alphapublic Color(float[] hsl,
float alpha)
hsl - HSL array where: 0 = hue, 1 = saturation, 2 = lightnessalpha - alpha inclusively between 0.0 and 1.0public Color(int color)
color - color integerpublic void setColor(String color)
color - hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB,
AARRGGBB, #ARGB, or ARGBpublic void setColor(String color, float opacity)
color - hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB,
AARRGGBB, #ARGB, or ARGBopacity - opacity float inclusively between 0.0 and 1.0public void setColor(String color, int alpha)
color - hex color in format #RRGGBB, RRGGBB, #RGB, RGB, #AARRGGBB,
AARRGGBB, #ARGB, or ARGBalpha - alpha integer color inclusively between 0 and 255public void setColor(String red, String green, String blue)
red - red hex color in format RRgreen - green hex color in format GGblue - blue hex color in format BBpublic void setColor(String red, String green, String blue, String alpha)
red - red hex color in format RRgreen - green hex color in format GGblue - blue hex color in format BBalpha - alpha hex color in format AApublic void setColor(String red, String green, String blue, float opacity)
red - red hex color in format RRgreen - green hex color in format GGblue - blue hex color in format BBopacity - opacity float inclusively between 0.0 and 1.0public void setColor(int red,
int green,
int blue)
red - red integer color inclusively between 0 and 255green - green integer color inclusively between 0 and 255blue - blue integer color inclusively between 0 and 255public void setColor(int red,
int green,
int blue,
int alpha)
red - red integer color inclusively between 0 and 255green - green integer color inclusively between 0 and 255blue - blue integer color inclusively between 0 and 255alpha - alpha integer color inclusively between 0 and 255public void setColor(int red,
int green,
int blue,
float opacity)
red - red integer color inclusively between 0 and 255green - green integer color inclusively between 0 and 255blue - blue integer color inclusively between 0 and 255opacity - opacity float inclusively between 0.0 and 1.0public void setColor(float red,
float green,
float blue)
red - red float color inclusively between 0.0 and 1.0green - green float color inclusively between 0.0 and 1.0blue - blue float color inclusively between 0.0 and 1.0public void setColor(float red,
float green,
float blue,
float opacity)
red - red float color inclusively between 0.0 and 1.0green - green float color inclusively between 0.0 and 1.0blue - blue float color inclusively between 0.0 and 1.0opacity - opacity float inclusively between 0.0 and 1.0public void setColorByHSL(float hue,
float saturation,
float lightness)
hue - hue value inclusively between 0.0 and 360.0saturation - saturation inclusively between 0.0 and 1.0lightness - lightness inclusively between 0.0 and 1.0public void setColorByHSL(float hue,
float saturation,
float lightness,
float alpha)
hue - hue value inclusively between 0.0 and 360.0saturation - saturation inclusively between 0.0 and 1.0lightness - lightness inclusively between 0.0 and 1.0alpha - alpha inclusively between 0.0 and 1.0public void setColor(int color)
color - color integerpublic void setRed(String red)
red - red hex color in format RR or Rpublic void setGreen(String green)
green - green hex color in format GG or Gpublic void setBlue(String blue)
blue - blue hex color in format BB or Bpublic void setAlpha(String alpha)
alpha - alpha hex color in format AA or Apublic void setRed(int red)
red - red integer color inclusively between 0 and 255public void setGreen(int green)
green - green integer color inclusively between 0 and 255public void setBlue(int blue)
blue - blue integer color inclusively between 0 and 255public void setAlpha(int alpha)
alpha - alpha integer color inclusively between 0 and 255public void setRed(float red)
red - red float color inclusively between 0.0 and 1.0public void setGreen(float green)
green - green float color inclusively between 0.0 and 1.0public void setBlue(float blue)
blue - blue float color inclusively between 0.0 and 1.0public void setOpacity(float opacity)
opacity - opacity float color inclusively between 0.0 and 1.0public void setAlpha(float alpha)
alpha - alpha float color inclusively between 0.0 and 1.0public boolean isOpaque()
public String getColorHex()
public String getColorHexWithAlpha()
public String getColorHexShorthand()
public String getColorHexShorthandWithAlpha()
public int getColor()
public int getColorWithAlpha()
public String getRedHex()
public String getGreenHex()
public String getBlueHex()
public String getAlphaHex()
public String getRedHexShorthand()
public String getGreenHexShorthand()
public String getBlueHexShorthand()
public String getAlphaHexShorthand()
public int getRed()
public int getGreen()
public int getBlue()
public int getAlpha()
public float getRedArithmetic()
public float getGreenArithmetic()
public float getBlueArithmetic()
public float getOpacity()
public float getAlphaArithmetic()
public float[] getHSL()
public float getHue()
public float getSaturation()
public float getLightness()
Copyright © 2019 National Geospatial-Intelligence Agency. All rights reserved.