Class Color
java.lang.Object
software.xdev.chartjs.model.color.Color
Immutable RGBa color model.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Color -
Constructor Summary
ConstructorsConstructorDescriptionColor(int r, int g, int b) Constructs a new Color instance with alpha set fully opaqueColor(int r, int g, int b, double alpha) Constructs a new Color instanceConstructs a new Color instance with the RGB values of the Color argument and the alpha transparency of the double argument. -
Method Summary
Modifier and TypeMethodDescriptionbooleandoublegetAlpha()intgetB()intgetG()intgetR()inthashCode()static booleanisAlphaWithinBounds(double alpha) Verify that argument is valid value for the alpha channel.static booleanisChannelWithinBounds(int channel) Verify that argument is valid value for the R, G or B channel.static Colorrandom()Constructs and returns a new fully random Color instance.rgba()toString()
-
Field Details
-
TRANSPARENT
-
BLACK
-
WHITE
-
RED
-
LIME
-
BLUE
-
YELLOW
-
CYAN
-
MAGENTA
-
SILVER
-
GRAY
-
MAROON
-
OLIVE
-
GREEN
-
PURPLE
-
TEAL
-
NAVY
-
DARK_RED
-
BROWN
-
CRIMSON
-
DARK_SALMON
-
SALMON
-
LIGHT_SALMON
-
ORANGE_RED
-
DARK_ORANGE
-
ORANGE
-
GOLD
-
DARK_KHAKI
-
KHAKI
-
YELLOW_GREEN
-
DARK_OLIVE_GREEN
-
GREEN_YELLOW
-
DARK_GREEN
-
DARK_CYAN
-
LIGHT_CYAN
-
AQUA
-
DARK_TURQUOISE
-
TURQUOISE
-
MEDIUM_TURQUOISE
-
PALE_TURQUOISE
-
AQUA_MARINE
-
LIGHT_BLUE
-
SKY_BLUE
-
LIGHT_SKY_BLUE
-
MIDNIGHT_BLUE
-
DARK_BLUE
-
MEDIUM_BLUE
-
BLUE_VIOLET
-
VIOLET
-
DEEP_PINK
-
HOT_PINK
-
LIGHT_PINK
-
PINK
-
LIGHT_YELLOW
-
CHOCOLATE
-
TAN
-
LINEN
-
LAVENDER
-
AZURE
-
DIM_GRAY
-
DARK_GRAY
-
LIGHT_GRAY
-
-
Constructor Details
-
Color
public Color(int r, int g, int b, double alpha) Constructs a new Color instance- Parameters:
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.
-
Color
public Color(int r, int g, int b) Constructs a new Color instance with alpha set fully opaque- Parameters:
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).
-
Color
Constructs a new Color instance with the RGB values of the Color argument and the alpha transparency of the double argument.
-
-
Method Details
-
random
Constructs and returns a new fully random Color instance.- Returns:
- Color
-
isChannelWithinBounds
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.
- Parameters:
channel-- Returns:
- true if argument is valid R, G or B value
-
isAlphaWithinBounds
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.
- Parameters:
alpha-- Returns:
- true if argument is valid alpha value
-
getR
public int getR()- Returns:
- red channel value, between 0 and 255 (inclusive)
-
getG
public int getG()- Returns:
- green channel value, between 0 and 255 (inclusive)
-
getB
public int getB()- Returns:
- blue channel value, between 0 and 255 (inclusive)
-
getAlpha
public double getAlpha()- Returns:
- alpha channel value, between 0.0d and 1.0d (inclusive)
-
rgba
- Returns:
- serialized version of this
Color, as used for JSON.
-
toString
-
equals
-
hashCode
public int hashCode()
-