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 colors there is a note in the documentation.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Colorstatic final Colorstatic final ColorThis color is a synonym forBLUE.static final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final ColorThis color is a synonym forAQUA.static 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 ColorThis color differs fromColor.DARK_GRAYNote that this color does not match CSS dark gray but instead matches CSS gray.static 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 ColorThis color is a synonym forMAGENTA.static final Colorstatic final Colorstatic final Colorstatic final Colorstatic final ColorThis color differs fromColor.GRAY.static final ColorThis color differs fromColor.GREEN.static 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 ColorThis color differs fromColor.LIGHT_GRAY.static final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final ColorThis color is a synonym forFUCHSIA.static 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 ColorThis color differs fromColor.ORANGE.static final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final Colorstatic final ColorThis color differs fromColor.PINK.static 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorfromBaseColor(Color baseColor, int alpha) Creates a new Color based of the baseColor but with a different alpha value.static ColorfromGrayscale(int gray) Creates a grayscale color where its color component (red, green, blue) all have the same value.static ColorfromRGB(int rgb) Creates a rgba color with the alpha implicitly being 255.static ColorfromRGB(int red, int green, int blue) Creates a rgba color with the alpha implicitly being 255.static ColorfromRGBA(int rgba) Creates a rgba color.static ColorfromRGBA(int red, int green, int blue, int alpha) Creates a rgba color.static ColorGenerates a random color.
-
Field Details
-
BLACK
-
NAVY
-
DARK_BLUE
-
MEDIUM_BLUE
-
BLUE
This color is a synonym forAQUA. -
DARK_GREEN
-
GREEN
This color differs fromColor.GREEN. If you want awt Green useLIMEinstead. -
TEAL
-
DARK_CYAN
-
DEEP_SKY_BLUE
-
DARK_TURQUOISE
-
MEDIUM_SPRING_GREEN
-
LIME
-
SPRING_GREEN
-
AQUA
This color is a synonym forBLUE. -
CYAN
-
MIDNIGHT_BLUE
-
DODGER_BLUE
-
LIGHT_SEA_GREEN
-
FOREST_GREEN
-
SEA_GREEN
-
DARK_SLATE_GRAY
-
LIME_GREEN
-
MEDIUM_SEA_GREEN
-
TURQUOISE
-
ROYAL_BLUE
-
STEEL_BLUE
-
DARK_SLATE_BLUE
-
MEDIUM_TURQUOISE
-
INDIGO
-
DARK_OLIVE_GREEN
-
CADET_BLUE
-
CORNFLOWER_BLUE
-
REBECCA_PURPLE
-
MEDIUM_AQUA_MARINE
-
DIM_GRAY
-
SLATE_BLUE
-
OLIVE_DRAB
-
SLATE_GRAY
-
LIGHT_SLATE_GRAY
-
MEDIUM_SLATE_BLUE
-
LAWN_GREEN
-
CHARTREUSE
-
AQUAMARINE
-
MAROON
-
PURPLE
-
OLIVE
-
GRAY
This color differs fromColor.GRAY. If you want awt gray useDARK_GRAYinstead. Note that this color does not match CSS gray but instead matches CSS dark gray. -
SKY_BLUE
-
LIGHT_SKY_BLUE
-
BLUE_VIOLET
-
DARK_RED
-
DARK_MAGENTA
-
SADDLE_BROWN
-
DARK_SEA_GREEN
-
LIGHT_GREEN
-
MEDIUM_PURPLE
-
DARK_VIOLET
-
PALE_GREEN
-
DARK_ORCHID
-
YELLOW_GREEN
-
SIENNA
-
BROWN
-
DARK_GRAY
This color differs fromColor.DARK_GRAYNote that this color does not match CSS dark gray but instead matches CSS gray. -
LIGHT_BLUE
-
GREEN_YELLOW
-
PALE_TURQUOISE
-
LIGHT_STEEL_BLUE
-
POWDER_BLUE
-
FIRE_BRICK
-
DARK_GOLDEN_ROD
-
MEDIUM_ORCHID
-
ROSY_BROWN
-
DARK_KHAKI
-
SILVER
-
MEDIUM_VIOLET_RED
-
INDIAN_RED
-
PERU
-
CHOCOLATE
-
TAN
-
LIGHT_GRAY
This color differs fromColor.LIGHT_GRAY. If you want awt light gray useSILVERinstead. -
THISTLE
-
ORCHID
-
GOLDEN_ROD
-
PALE_VIOLET_RED
-
CRIMSON
-
GAINSBORO
-
PLUM
-
BURLY_WOOD
-
LIGHT_CYAN
-
LAVENDER
-
DARK_SALMON
-
VIOLET
-
PALE_GOLDEN_ROD
-
LIGHT_CORAL
-
KHAKI
-
ALICE_BLUE
-
HONEY_DEW
-
AZURE
-
SANDY_BROWN
-
WHEAT
-
BEIGE
-
WHITE_SMOKE
-
MINT_CREAM
-
GHOST_WHITE
-
SALMON
-
ANTIQUE_WHITE
-
LINEN
-
LIGHT_GOLDEN_ROD_YELLOW
-
OLD_LACE
-
RED
-
FUCHSIA
This color is a synonym forMAGENTA. -
MAGENTA
This color is a synonym forFUCHSIA. -
DEEP_PINK
-
ORANGE_RED
-
TOMATO
-
HOT_PINK
-
CORAL
-
DARK_ORANGE
-
LIGHT_SALMON
-
ORANGE
This color differs fromColor.ORANGE. -
LIGHT_PINK
-
PINK
This color differs fromColor.PINK. -
GOLD
-
PEACH_PUFF
-
NAVAJO_WHITE
-
MOCCASIN
-
BISQUE
-
MISTY_ROSE
-
BLANCHED_ALMOND
-
PAPAYA_WHIP
-
LAVENDER_BLUSH
-
SEA_SHELL
-
CORNSILK
-
LEMON_CHIFFON
-
FLORAL_WHITE
-
SNOW
-
YELLOW
-
LIGHT_YELLOW
-
IVORY
-
WHITE
-
-
Method Details
-
randomColor
Generates a random color. The color will not be transparent.- Returns:
- a random color.
-
fromGrayscale
Creates a grayscale color where its color component (red, green, blue) all have the same value. 0 is white. 255 is black. 128 would be gray.- Parameters:
gray- The value can range from 0 to 255.
-
fromRGB
Creates a 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)
-
fromRGB
Creates a rgba color with the alpha implicitly being 255. 0 is no color. 255 is maximum 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.
-
fromRGBA
Creates a 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 128.- Parameters:
rgba- any valid integer value.
-
fromBaseColor
Creates a new Color based of the baseColor but with a different alpha value.- Parameters:
baseColor- Any color. It's alpha value will be ignored when creating the new color.alpha- The value can range from 0 to 255
-
fromRGBA
Creates a rgba color. 0 is no color. 255 is maximum 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.alpha- The value can range from 0 to 255. 0 is invisible. 255 is 100% visible.
-