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 colors there is a note in the documentation.
  • Field Details

    • BLACK

      public static final Color BLACK
    • DARK_BLUE

      public static final Color DARK_BLUE
    • MEDIUM_BLUE

      public static final Color MEDIUM_BLUE
    • BLUE

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

      public static final Color DARK_GREEN
    • GREEN

      public static final Color GREEN
      This color differs from Color.GREEN. If you want awt Green use LIME instead.
    • TEAL

      public static final Color TEAL
    • DARK_CYAN

      public static final Color DARK_CYAN
    • DEEP_SKY_BLUE

      public static final Color DEEP_SKY_BLUE
    • DARK_TURQUOISE

      public static final Color DARK_TURQUOISE
    • MEDIUM_SPRING_GREEN

      public static final Color MEDIUM_SPRING_GREEN
    • LIME

      public static final Color LIME
    • SPRING_GREEN

      public static final Color SPRING_GREEN
    • AQUA

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

      public static final Color CYAN
    • MIDNIGHT_BLUE

      public static final Color MIDNIGHT_BLUE
    • DODGER_BLUE

      public static final Color DODGER_BLUE
    • LIGHT_SEA_GREEN

      public static final Color LIGHT_SEA_GREEN
    • FOREST_GREEN

      public static final Color FOREST_GREEN
    • SEA_GREEN

      public static final Color SEA_GREEN
    • DARK_SLATE_GRAY

      public static final Color DARK_SLATE_GRAY
    • LIME_GREEN

      public static final Color LIME_GREEN
    • MEDIUM_SEA_GREEN

      public static final Color MEDIUM_SEA_GREEN
    • TURQUOISE

      public static final Color TURQUOISE
    • ROYAL_BLUE

      public static final Color ROYAL_BLUE
    • STEEL_BLUE

      public static final Color STEEL_BLUE
    • DARK_SLATE_BLUE

      public static final Color DARK_SLATE_BLUE
    • MEDIUM_TURQUOISE

      public static final Color MEDIUM_TURQUOISE
    • INDIGO

      public static final Color INDIGO
    • DARK_OLIVE_GREEN

      public static final Color DARK_OLIVE_GREEN
    • CADET_BLUE

      public static final Color CADET_BLUE
    • CORNFLOWER_BLUE

      public static final Color CORNFLOWER_BLUE
    • REBECCA_PURPLE

      public static final Color REBECCA_PURPLE
    • MEDIUM_AQUA_MARINE

      public static final Color MEDIUM_AQUA_MARINE
    • DIM_GRAY

      public static final Color DIM_GRAY
    • SLATE_BLUE

      public static final Color SLATE_BLUE
    • OLIVE_DRAB

      public static final Color OLIVE_DRAB
    • SLATE_GRAY

      public static final Color SLATE_GRAY
    • LIGHT_SLATE_GRAY

      public static final Color LIGHT_SLATE_GRAY
    • MEDIUM_SLATE_BLUE

      public static final Color MEDIUM_SLATE_BLUE
    • LAWN_GREEN

      public static final Color LAWN_GREEN
    • CHARTREUSE

      public static final Color CHARTREUSE
    • AQUAMARINE

      public static final Color AQUAMARINE
    • MAROON

      public static final Color MAROON
    • PURPLE

      public static final Color PURPLE
    • OLIVE

      public static final Color OLIVE
    • GRAY

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

      public static final Color SKY_BLUE
    • LIGHT_SKY_BLUE

      public static final Color LIGHT_SKY_BLUE
    • BLUE_VIOLET

      public static final Color BLUE_VIOLET
    • DARK_RED

      public static final Color DARK_RED
    • DARK_MAGENTA

      public static final Color DARK_MAGENTA
    • SADDLE_BROWN

      public static final Color SADDLE_BROWN
    • DARK_SEA_GREEN

      public static final Color DARK_SEA_GREEN
    • LIGHT_GREEN

      public static final Color LIGHT_GREEN
    • MEDIUM_PURPLE

      public static final Color MEDIUM_PURPLE
    • DARK_VIOLET

      public static final Color DARK_VIOLET
    • PALE_GREEN

      public static final Color PALE_GREEN
    • DARK_ORCHID

      public static final Color DARK_ORCHID
    • YELLOW_GREEN

      public static final Color YELLOW_GREEN
    • SIENNA

      public static final Color SIENNA
    • BROWN

      public static final Color BROWN
    • 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.
    • LIGHT_BLUE

      public static final Color LIGHT_BLUE
    • GREEN_YELLOW

      public static final Color GREEN_YELLOW
    • PALE_TURQUOISE

      public static final Color PALE_TURQUOISE
    • LIGHT_STEEL_BLUE

      public static final Color LIGHT_STEEL_BLUE
    • POWDER_BLUE

      public static final Color POWDER_BLUE
    • FIRE_BRICK

      public static final Color FIRE_BRICK
    • DARK_GOLDEN_ROD

      public static final Color DARK_GOLDEN_ROD
    • MEDIUM_ORCHID

      public static final Color MEDIUM_ORCHID
    • ROSY_BROWN

      public static final Color ROSY_BROWN
    • DARK_KHAKI

      public static final Color DARK_KHAKI
    • SILVER

      public static final Color SILVER
    • MEDIUM_VIOLET_RED

      public static final Color MEDIUM_VIOLET_RED
    • INDIAN_RED

      public static final Color INDIAN_RED
    • PERU

      public static final Color PERU
    • CHOCOLATE

      public static final Color CHOCOLATE
    • TAN

      public static final Color TAN
    • LIGHT_GRAY

      public static final Color LIGHT_GRAY
      This color differs from Color.LIGHT_GRAY. If you want awt light gray use SILVER instead.
    • THISTLE

      public static final Color THISTLE
    • ORCHID

      public static final Color ORCHID
    • GOLDEN_ROD

      public static final Color GOLDEN_ROD
    • PALE_VIOLET_RED

      public static final Color PALE_VIOLET_RED
    • CRIMSON

      public static final Color CRIMSON
    • GAINSBORO

      public static final Color GAINSBORO
    • PLUM

      public static final Color PLUM
    • BURLY_WOOD

      public static final Color BURLY_WOOD
    • LIGHT_CYAN

      public static final Color LIGHT_CYAN
    • LAVENDER

      public static final Color LAVENDER
    • DARK_SALMON

      public static final Color DARK_SALMON
    • VIOLET

      public static final Color VIOLET
    • PALE_GOLDEN_ROD

      public static final Color PALE_GOLDEN_ROD
    • LIGHT_CORAL

      public static final Color LIGHT_CORAL
    • KHAKI

      public static final Color KHAKI
    • ALICE_BLUE

      public static final Color ALICE_BLUE
    • HONEY_DEW

      public static final Color HONEY_DEW
    • AZURE

      public static final Color AZURE
    • SANDY_BROWN

      public static final Color SANDY_BROWN
    • WHEAT

      public static final Color WHEAT
    • BEIGE

      public static final Color BEIGE
    • WHITE_SMOKE

      public static final Color WHITE_SMOKE
    • MINT_CREAM

      public static final Color MINT_CREAM
    • GHOST_WHITE

      public static final Color GHOST_WHITE
    • SALMON

      public static final Color SALMON
    • ANTIQUE_WHITE

      public static final Color ANTIQUE_WHITE
    • LINEN

      public static final Color LINEN
    • LIGHT_GOLDEN_ROD_YELLOW

      public static final Color LIGHT_GOLDEN_ROD_YELLOW
    • OLD_LACE

      public static final Color OLD_LACE
    • RED

      public static final Color RED
    • FUCHSIA

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

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

      public static final Color DEEP_PINK
    • ORANGE_RED

      public static final Color ORANGE_RED
    • TOMATO

      public static final Color TOMATO
    • HOT_PINK

      public static final Color HOT_PINK
    • CORAL

      public static final Color CORAL
    • DARK_ORANGE

      public static final Color DARK_ORANGE
    • LIGHT_SALMON

      public static final Color LIGHT_SALMON
    • ORANGE

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

      public static final Color LIGHT_PINK
    • PINK

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

      public static final Color GOLD
    • PEACH_PUFF

      public static final Color PEACH_PUFF
    • MOCCASIN

      public static final Color MOCCASIN
    • BISQUE

      public static final Color BISQUE
    • MISTY_ROSE

      public static final Color MISTY_ROSE
    • BLANCHED_ALMOND

      public static final Color BLANCHED_ALMOND
    • PAPAYA_WHIP

      public static final Color PAPAYA_WHIP
    • LAVENDER_BLUSH

      public static final Color LAVENDER_BLUSH
    • SEA_SHELL

      public static final Color SEA_SHELL
    • CORNSILK

      public static final Color CORNSILK
    • LEMON_CHIFFON

      public static final Color LEMON_CHIFFON
    • FLORAL_WHITE

      public static final Color FLORAL_WHITE
    • SNOW

      public static final Color SNOW
    • YELLOW

      public static final Color YELLOW
    • LIGHT_YELLOW

      public static final Color LIGHT_YELLOW
    • IVORY

      public static final Color IVORY
    • WHITE

      public static final Color WHITE
  • Method Details

    • randomColor

      public static Color randomColor()
      Generates a random color. The color will not be transparent.
      Returns:
      a random color.
    • fromGrayscale

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

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

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

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

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

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