Package codedraw

Class Palette

java.lang.Object
codedraw.Palette

public final class Palette extends Object
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 Details

    • TRANSPARENT

      public static final Color TRANSPARENT
    • ALICE_BLUE

      public static final Color ALICE_BLUE
    • ANTIQUE_WHITE

      public static final Color ANTIQUE_WHITE
    • AQUA

      public static final Color AQUA
      This color is a synonym for BLUE.
    • AQUAMARINE

      public static final Color AQUAMARINE
    • AZURE

      public static final Color AZURE
    • BEIGE

      public static final Color BEIGE
    • BISQUE

      public static final Color BISQUE
    • BLACK

      public static final Color BLACK
    • BLANCHED_ALMOND

      public static final Color BLANCHED_ALMOND
    • BLUE

      public static final Color BLUE
      This color is a synonym for AQUA.
    • BLUE_VIOLET

      public static final Color BLUE_VIOLET
    • BROWN

      public static final Color BROWN
    • BURLY_WOOD

      public static final Color BURLY_WOOD
    • CADET_BLUE

      public static final Color CADET_BLUE
    • CHARTREUSE

      public static final Color CHARTREUSE
    • CHOCOLATE

      public static final Color CHOCOLATE
    • CORAL

      public static final Color CORAL
    • CORNFLOWER_BLUE

      public static final Color CORNFLOWER_BLUE
    • CORNSILK

      public static final Color CORNSILK
    • CRIMSON

      public static final Color CRIMSON
    • CYAN

      public static final Color CYAN
    • DARK_BLUE

      public static final Color DARK_BLUE
    • DARK_CYAN

      public static final Color DARK_CYAN
    • DARK_GOLDEN_ROD

      public static final Color DARK_GOLDEN_ROD
    • DARK_GRAY

      public static final Color DARK_GRAY
      This color differs from Color.DARK_GRAY Note that this color does not match CSS dark gray but instead matches CSS gray.
    • DARK_GREEN

      public static final Color DARK_GREEN
    • DARK_KHAKI

      public static final Color DARK_KHAKI
    • DARK_MAGENTA

      public static final Color DARK_MAGENTA
    • DARK_OLIVE_GREEN

      public static final Color DARK_OLIVE_GREEN
    • DARK_ORANGE

      public static final Color DARK_ORANGE
    • DARK_ORCHID

      public static final Color DARK_ORCHID
    • DARK_RED

      public static final Color DARK_RED
    • DARK_SALMON

      public static final Color DARK_SALMON
    • DARK_SEA_GREEN

      public static final Color DARK_SEA_GREEN
    • DARK_SLATE_BLUE

      public static final Color DARK_SLATE_BLUE
    • DARK_SLATE_GRAY

      public static final Color DARK_SLATE_GRAY
    • DARK_TURQUOISE

      public static final Color DARK_TURQUOISE
    • DARK_VIOLET

      public static final Color DARK_VIOLET
    • DEEP_PINK

      public static final Color DEEP_PINK
    • DEEP_SKY_BLUE

      public static final Color DEEP_SKY_BLUE
    • DIM_GRAY

      public static final Color DIM_GRAY
    • DODGER_BLUE

      public static final Color DODGER_BLUE
    • FIRE_BRICK

      public static final Color FIRE_BRICK
    • FLORAL_WHITE

      public static final Color FLORAL_WHITE
    • FOREST_GREEN

      public static final Color FOREST_GREEN
    • FUCHSIA

      public static final Color FUCHSIA
      This color is a synonym for MAGENTA.
    • GAINSBORO

      public static final Color GAINSBORO
    • GHOST_WHITE

      public static final Color GHOST_WHITE
    • GOLD

      public static final Color GOLD
    • GOLDEN_ROD

      public static final Color GOLDEN_ROD
    • GRAY

      public static final Color GRAY
      This color differs from Color.GRAY. If you want AWT's gray use DARK_GRAY instead. Note that this color does not match CSS gray but instead matches CSS dark gray.
    • GREEN

      public static final Color GREEN
      This color differs from Color.GREEN. If you want AWT's Green use LIME instead.
    • GREEN_YELLOW

      public static final Color GREEN_YELLOW
    • HONEY_DEW

      public static final Color HONEY_DEW
    • HOT_PINK

      public static final Color HOT_PINK
    • INDIAN_RED

      public static final Color INDIAN_RED
    • INDIGO

      public static final Color INDIGO
    • IVORY

      public static final Color IVORY
    • KHAKI

      public static final Color KHAKI
    • LAVENDER

      public static final Color LAVENDER
    • LAVENDER_BLUSH

      public static final Color LAVENDER_BLUSH
    • LAWN_GREEN

      public static final Color LAWN_GREEN
    • LEMON_CHIFFON

      public static final Color LEMON_CHIFFON
    • LIGHT_BLUE

      public static final Color LIGHT_BLUE
    • LIGHT_CORAL

      public static final Color LIGHT_CORAL
    • LIGHT_CYAN

      public static final Color LIGHT_CYAN
    • LIGHT_GOLDEN_ROD_YELLOW

      public static final Color LIGHT_GOLDEN_ROD_YELLOW
    • LIGHT_GRAY

      public static final Color LIGHT_GRAY
      This color differs from Color.LIGHT_GRAY. If you want AWT's light gray use SILVER instead.
    • LIGHT_GREEN

      public static final Color LIGHT_GREEN
    • LIGHT_PINK

      public static final Color LIGHT_PINK
    • LIGHT_SALMON

      public static final Color LIGHT_SALMON
    • LIGHT_SEA_GREEN

      public static final Color LIGHT_SEA_GREEN
    • LIGHT_SKY_BLUE

      public static final Color LIGHT_SKY_BLUE
    • LIGHT_SLATE_GRAY

      public static final Color LIGHT_SLATE_GRAY
    • LIGHT_STEEL_BLUE

      public static final Color LIGHT_STEEL_BLUE
    • LIGHT_YELLOW

      public static final Color LIGHT_YELLOW
    • LIME

      public static final Color LIME
    • LIME_GREEN

      public static final Color LIME_GREEN
    • LINEN

      public static final Color LINEN
    • MAGENTA

      public static final Color MAGENTA
      This color is a synonym for FUCHSIA.
    • MAROON

      public static final Color MAROON
    • MEDIUM_AQUA_MARINE

      public static final Color MEDIUM_AQUA_MARINE
    • MEDIUM_BLUE

      public static final Color MEDIUM_BLUE
    • MEDIUM_ORCHID

      public static final Color MEDIUM_ORCHID
    • MEDIUM_PURPLE

      public static final Color MEDIUM_PURPLE
    • MEDIUM_SEA_GREEN

      public static final Color MEDIUM_SEA_GREEN
    • MEDIUM_SLATE_BLUE

      public static final Color MEDIUM_SLATE_BLUE
    • MEDIUM_SPRING_GREEN

      public static final Color MEDIUM_SPRING_GREEN
    • MEDIUM_TURQUOISE

      public static final Color MEDIUM_TURQUOISE
    • MEDIUM_VIOLET_RED

      public static final Color MEDIUM_VIOLET_RED
    • MIDNIGHT_BLUE

      public static final Color MIDNIGHT_BLUE
    • MINT_CREAM

      public static final Color MINT_CREAM
    • MISTY_ROSE

      public static final Color MISTY_ROSE
    • MOCCASIN

      public static final Color MOCCASIN
    • OLD_LACE

      public static final Color OLD_LACE
    • OLIVE

      public static final Color OLIVE
    • OLIVE_DRAB

      public static final Color OLIVE_DRAB
    • ORANGE

      public static final Color ORANGE
      This color differs from Color.ORANGE.
    • ORANGE_RED

      public static final Color ORANGE_RED
    • ORCHID

      public static final Color ORCHID
    • PALE_GOLDEN_ROD

      public static final Color PALE_GOLDEN_ROD
    • PALE_GREEN

      public static final Color PALE_GREEN
    • PALE_TURQUOISE

      public static final Color PALE_TURQUOISE
    • PALE_VIOLET_RED

      public static final Color PALE_VIOLET_RED
    • PAPAYA_WHIP

      public static final Color PAPAYA_WHIP
    • PEACH_PUFF

      public static final Color PEACH_PUFF
    • PERU

      public static final Color PERU
    • PINK

      public static final Color PINK
      This color differs from Color.PINK.
    • PLUM

      public static final Color PLUM
    • POWDER_BLUE

      public static final Color POWDER_BLUE
    • PURPLE

      public static final Color PURPLE
    • RED

      public static final Color RED
    • ROSY_BROWN

      public static final Color ROSY_BROWN
    • ROYAL_BLUE

      public static final Color ROYAL_BLUE
    • SADDLE_BROWN

      public static final Color SADDLE_BROWN
    • SALMON

      public static final Color SALMON
    • SANDY_BROWN

      public static final Color SANDY_BROWN
    • SEA_GREEN

      public static final Color SEA_GREEN
    • SEA_SHELL

      public static final Color SEA_SHELL
    • SIENNA

      public static final Color SIENNA
    • SILVER

      public static final Color SILVER
    • SKY_BLUE

      public static final Color SKY_BLUE
    • SLATE_BLUE

      public static final Color SLATE_BLUE
    • SLATE_GRAY

      public static final Color SLATE_GRAY
    • SNOW

      public static final Color SNOW
    • SPRING_GREEN

      public static final Color SPRING_GREEN
    • STEEL_BLUE

      public static final Color STEEL_BLUE
    • TAN

      public static final Color TAN
    • TEAL

      public static final Color TEAL
    • THISTLE

      public static final Color THISTLE
    • TOMATO

      public static final Color TOMATO
    • TURQUOISE

      public static final Color TURQUOISE
    • VIOLET

      public static final Color VIOLET
    • WHEAT

      public static final Color WHEAT
    • WHITE

      public static final Color WHITE
    • WHITE_SMOKE

      public static final Color WHITE_SMOKE
    • YELLOW

      public static final Color YELLOW
    • YELLOW_GREEN

      public static final Color YELLOW_GREEN
  • Method Details

    • fromRGBA

      public static Color fromRGBA(int red, int green, int blue, int transparency)
      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

      public static Color fromRGBA(int rgba)
      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

      public static Color fromRGB(int red, int green, int blue)
      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

      public static Color fromRGB(int rgb)
      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

      public static Color fromGrayscale(int gray)
      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

      public static Color fromBaseColor(Color baseColor, int transparency)
      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

      public static Color randomColor()
      Generates a random color that is not transparent.
      Returns:
      a random color.
    • fromHSV

      public static Color fromHSV(int hue, int saturation, int brightness)
      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.