Package codedraw
Class Palette
java.lang.Object
codedraw.Palette
Palette provides a wide variety of colors and makes it easier to create colors.
Alternatively you can just use AWT
Color
.
Palette takes all the colors from the CSS colors but switches GRAY and DARK_GRAY,
so that DARK_GRAY is darker than GRAY.
If the Palette color does not match the AWT color or CSS color there is a note in the documentation.-
Field Summary
Modifier and TypeFieldDescriptionstatic final Color
static final Color
static final Color
This color is a synonym forBLUE
.static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
static final Color
This color is a synonym forAQUA
.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
This color differs fromColor.DARK_GRAY
Note that this color does not match CSS dark gray but instead matches CSS gray.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
static final Color
static final Color
static final Color
static final Color
static final Color
This color is a synonym forMAGENTA
.static final Color
static final Color
static final Color
static final Color
static final Color
This color differs fromColor.GRAY
.static final Color
This color differs fromColor.GREEN
.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
This color differs fromColor.LIGHT_GRAY
.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
This color is a synonym forFUCHSIA
.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
static final Color
static final Color
static final Color
static final Color
This color differs fromColor.ORANGE
.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
This color differs fromColor.PINK
.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
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic Color
fromBaseColor
(Color baseColor, int transparency) Creates a new color based on the base color but with a different transparency value.static Color
fromGrayscale
(int gray) Creates a grayscale color where its color component red, green and blue all have the same value.static Color
fromHSV
(int hue, int saturation, int brightness) Converts a color from the HSV color space to the RGB color space.static Color
fromRGB
(int rgb) Creates an RGBA color with the alpha implicitly being 255.static Color
fromRGB
(int red, int green, int blue) Creates an RGBA color with the alpha implicitly being 255.static Color
fromRGBA
(int rgba) Creates an RGBA color.static Color
fromRGBA
(int red, int green, int blue, int transparency) Creates an RGBA color.static Color
Generates a random color that is not transparent.
-
Field Details
-
TRANSPARENT
-
ALICE_BLUE
-
ANTIQUE_WHITE
-
AQUA
This color is a synonym forBLUE
. -
AQUAMARINE
-
AZURE
-
BEIGE
-
BISQUE
-
BLACK
-
BLANCHED_ALMOND
-
BLUE
This color is a synonym forAQUA
. -
BLUE_VIOLET
-
BROWN
-
BURLY_WOOD
-
CADET_BLUE
-
CHARTREUSE
-
CHOCOLATE
-
CORAL
-
CORNFLOWER_BLUE
-
CORNSILK
-
CRIMSON
-
CYAN
-
DARK_BLUE
-
DARK_CYAN
-
DARK_GOLDEN_ROD
-
DARK_GRAY
This color differs fromColor.DARK_GRAY
Note that this color does not match CSS dark gray but instead matches CSS gray. -
DARK_GREEN
-
DARK_KHAKI
-
DARK_MAGENTA
-
DARK_OLIVE_GREEN
-
DARK_ORANGE
-
DARK_ORCHID
-
DARK_RED
-
DARK_SALMON
-
DARK_SEA_GREEN
-
DARK_SLATE_BLUE
-
DARK_SLATE_GRAY
-
DARK_TURQUOISE
-
DARK_VIOLET
-
DEEP_PINK
-
DEEP_SKY_BLUE
-
DIM_GRAY
-
DODGER_BLUE
-
FIRE_BRICK
-
FLORAL_WHITE
-
FOREST_GREEN
-
FUCHSIA
This color is a synonym forMAGENTA
. -
GAINSBORO
-
GHOST_WHITE
-
GOLD
-
GOLDEN_ROD
-
GRAY
This color differs fromColor.GRAY
. If you want AWT's gray useDARK_GRAY
instead. Note that this color does not match CSS gray but instead matches CSS dark gray. -
GREEN
This color differs fromColor.GREEN
. If you want AWT's Green useLIME
instead. -
GREEN_YELLOW
-
HONEY_DEW
-
HOT_PINK
-
INDIAN_RED
-
INDIGO
-
IVORY
-
KHAKI
-
LAVENDER
-
LAVENDER_BLUSH
-
LAWN_GREEN
-
LEMON_CHIFFON
-
LIGHT_BLUE
-
LIGHT_CORAL
-
LIGHT_CYAN
-
LIGHT_GOLDEN_ROD_YELLOW
-
LIGHT_GRAY
This color differs fromColor.LIGHT_GRAY
. If you want AWT's light gray useSILVER
instead. -
LIGHT_GREEN
-
LIGHT_PINK
-
LIGHT_SALMON
-
LIGHT_SEA_GREEN
-
LIGHT_SKY_BLUE
-
LIGHT_SLATE_GRAY
-
LIGHT_STEEL_BLUE
-
LIGHT_YELLOW
-
LIME
-
LIME_GREEN
-
LINEN
-
MAGENTA
This color is a synonym forFUCHSIA
. -
MAROON
-
MEDIUM_AQUA_MARINE
-
MEDIUM_BLUE
-
MEDIUM_ORCHID
-
MEDIUM_PURPLE
-
MEDIUM_SEA_GREEN
-
MEDIUM_SLATE_BLUE
-
MEDIUM_SPRING_GREEN
-
MEDIUM_TURQUOISE
-
MEDIUM_VIOLET_RED
-
MIDNIGHT_BLUE
-
MINT_CREAM
-
MISTY_ROSE
-
MOCCASIN
-
NAVAJO_WHITE
-
NAVY
-
OLD_LACE
-
OLIVE
-
OLIVE_DRAB
-
ORANGE
This color differs fromColor.ORANGE
. -
ORANGE_RED
-
ORCHID
-
PALE_GOLDEN_ROD
-
PALE_GREEN
-
PALE_TURQUOISE
-
PALE_VIOLET_RED
-
PAPAYA_WHIP
-
PEACH_PUFF
-
PERU
-
PINK
This color differs fromColor.PINK
. -
PLUM
-
POWDER_BLUE
-
PURPLE
-
RED
-
ROSY_BROWN
-
ROYAL_BLUE
-
SADDLE_BROWN
-
SALMON
-
SANDY_BROWN
-
SEA_GREEN
-
SEA_SHELL
-
SIENNA
-
SILVER
-
SKY_BLUE
-
SLATE_BLUE
-
SLATE_GRAY
-
SNOW
-
SPRING_GREEN
-
STEEL_BLUE
-
TAN
-
TEAL
-
THISTLE
-
TOMATO
-
TURQUOISE
-
VIOLET
-
WHEAT
-
WHITE
-
WHITE_SMOKE
-
YELLOW
-
YELLOW_GREEN
-
-
Method Details
-
fromRGBA
Creates an RGBA color. 0 is no color or black and 255 is the maximum amount of color.- Parameters:
red
- The value can range from 0 to 255.green
- The value can range from 0 to 255.blue
- The value can range from 0 to 255.transparency
- The value can range from 0 to 255. 0 is invisible and 255 is 100% visible.
-
fromRGBA
Creates an RGBA color. The 8 most significant bits represent red. The following 8 bits represent green. The next 8 bits represent blue. The 8 least significant bits represent the alpha value. For example Palette.fromRGBA(0xFF00FF80) would produce a pink color that is 50% transparent because both red and blue are set to 255 and the alpha value is set to 128.- Parameters:
rgba
- any integer value.
-
fromRGB
Creates an RGBA color with the alpha implicitly being 255. 0 is no color or black and 255 is maximum amount of color.- Parameters:
red
- The value can range from 0 to 255.green
- The value can range from 0 to 255.blue
- The value can range from 0 to 255.
-
fromRGB
Creates an RGBA color with the alpha implicitly being 255. The 8 most significant bits are ignored. The following 24 bits represent the red, green and blue amount of the color (8 bits each). For example Palette.fromRGB(0xFF00FF) would produce a pink color because both red and blue are set to 255.- Parameters:
rgb
- The value can range from 0 to 16777216 (0xFFFFFF in hexadecimal).
-
fromGrayscale
Creates a grayscale color where its color component red, green and blue all have the same value. 0 is white, 255 is black and 128 would be gray.- Parameters:
gray
- The value can range from 0 to 255.
-
fromBaseColor
Creates a new color based on the base color but with a different transparency value.- Parameters:
baseColor
- Any color. Its transparency value will be ignored when creating the new color.transparency
- The value can range from 0 to 255
-
randomColor
Generates a random color that is not transparent.- Returns:
- a random color.
-
fromHSV
Converts a color from the HSV color space to the RGB color space. See Wikipedia HSL and HSV for more information.- Parameters:
hue
- The coloration on a color wheel. Can be a value between 0 and 360.saturation
- The intensity of the color. Can be a value between 0 and 100.brightness
- The brightness or luminosity of the color. Can be a value between 0 and 100.- Returns:
- an RGB Color.
-