Package ghidra.util

# Class WebColors

java.lang.Object
ghidra.util.WebColors

public abstract class WebColors extends Object
Class for web color support. This class defines many of the colors used by html. This class includes methods for converting a color to a string (name or hex value) and for converting those strings back to a color.

Usage Note: Java's HTML rendering engine supports colors in hex form ('#aabb11'). Also, the engine supports many web color names ('silver'). However, not all web color names defined in this file are supported. Thus, when specifying HTML colors, do not rely on these web color names.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Color`
  `ALICE_BLUE`
  `static final Color`
  `ANTIQUE_WHITE`
  `static final Color`
  `AQUA`
  `static final Color`
  `AQUAMARINE`
  `static final Color`
  `AZURE`
  `static final Color`
  `BEIGE`
  `static final Color`
  `BISQUE`
  `static final Color`
  `BLACK`
  `static final Color`
  `BLANCHED_ALMOND`
  `static final Color`
  `BLUE`
  `static final Color`
  `BLUE_VIOLET`
  `static final Color`
  `BROWN`
  `static final Color`
  `BURLYWOOD`
  `static final Color`
  `CADET_BLUE`
  `static final Color`
  `CHARTREUSE`
  `static final Color`
  `CHOCOLATE`
  `static final Color`
  `CORAL`
  `static final Color`
  `CORNFLOWER_BLUE`
  `static final Color`
  `CORNSILK`
  `static final Color`
  `CRIMSON`
  `static final Color`
  `CYAN`
  `static final Color`
  `DARK_BLUE`
  `static final Color`
  `DARK_CYAN`
  `static final Color`
  `DARK_GOLDENROD`
  `static final Color`
  `DARK_GRAY`
  `static final Color`
  `DARK_GREEN`
  `static final Color`
  `DARK_KHAKI`
  `static final Color`
  `DARK_MAGENTA`
  `static final Color`
  `DARK_OLIVE_GREEN`
  `static final Color`
  `DARK_ORANGE`
  `static final Color`
  `DARK_ORCHID`
  `static final Color`
  `DARK_RED`
  `static final Color`
  `DARK_SALMON`
  `static final Color`
  `DARK_SEA_GREEN`
  `static final Color`
  `DARK_SLATE_BLUE`
  `static final Color`
  `DARK_SLATE_GRAY`
  `static final Color`
  `DARK_TURQUOSE`
  `static final Color`
  `DARK_VIOLET`
  `static final Color`
  `DEEP_PINK`
  `static final Color`
  `DEEP_SKY_BLUE`
  `static final Color`
  `DIM_GRAY`
  `static final Color`
  `DOGER_BLUE`
  `static final Color`
  `FIRE_BRICK`
  `static final Color`
  `FLORAL_WHITE`
  `static final Color`
  `FOREST_GREEN`
  `static final Color`
  `FUCHSIA`
  `static final Color`
  `GAINSBORO`
  `static final Color`
  `GHOST_WHITE`
  `static final Color`
  `GOLD`
  `static final Color`
  `GOLDEN_ROD`
  `static final Color`
  `GRAY`
  `static final Color`
  `GREEN`
  `static final Color`
  `GREEN_YELLOW`
  `static final Color`
  `HONEY_DEW`
  `static final Color`
  `HOT_PINK`
  `static final Color`
  `INDIAN_RED`
  `static final Color`
  `INDIGO`
  `static final Color`
  `IVORY`
  `static final Color`
  `KHAKE`
  `static final Color`
  `LAVENDER`
  `static final Color`
  `LAVENDER_BLUSH`
  `static final Color`
  `LAWN_GREEN`
  `static final Color`
  `LEMON_CHIFFON`
  `static final Color`
  `LIGHT_BLUE`
  `static final Color`
  `LIGHT_CORAL`
  `static final Color`
  `LIGHT_CYAN`
  `static final Color`
  `LIGHT_GOLDENROD`
  `static final Color`
  `LIGHT_GRAY`
  `static final Color`
  `LIGHT_GREEN`
  `static final Color`
  `LIGHT_PINK`
  `static final Color`
  `LIGHT_SALMON`
  `static final Color`
  `LIGHT_SEA_GREEN`
  `static final Color`
  `LIGHT_SKY_BLUE`
  `static final Color`
  `LIGHT_SLATE_GRAY`
  `static final Color`
  `LIGHT_STEEL_BLUE`
  `static final Color`
  `LIGHT_YELLOW`
  `static final Color`
  `LIME`
  `static final Color`
  `LIME_GREEN`
  `static final Color`
  `LINEN`
  `static final Color`
  `MAGENTA`
  `static final Color`
  `MAROON`
  `static final Color`
  `MEDIUM_BLUE`
  `static final Color`
  `MEDIUM_ORCHID`
  `static final Color`
  `MEDIUM_PURPLE`
  `static final Color`
  `MEDIUM_SEA_GREEN`
  `static final Color`
  `MEDIUM_SLATE_BLUE`
  `static final Color`
  `MEDIUM_SPRING_GREEN`
  `static final Color`
  `MEDIUM_TURQOISE`
  `static final Color`
  `MEDIUM_VIOLET_RED`
  `static final Color`
  `MEDUM_AQUA_MARINE`
  `static final Color`
  `MIDNIGHT_BLUE`
  `static final Color`
  `MINT_CREAM`
  `static final Color`
  `MISTY_ROSE`
  `static final Color`
  `MOCCASIN`
  `static final Color`
  `NAVAJO_WHITE`
  `static final Color`
  `NAVY`
  `static final Color`
  `OLDLACE`
  `static final Color`
  `OLIVE`
  `static final Color`
  `OLIVE_DRAB`
  `static final Color`
  `ORANGE`
  `static final Color`
  `ORANGE_RED`
  `static final Color`
  `ORCHID`
  `static final Color`
  `PALE_GOLDENROD`
  `static final Color`
  `PALE_GREEN`
  `static final Color`
  `PALE_TURQUOISE`
  `static final Color`
  `PALE_VIOLET_RED`
  `static final Color`
  `PAPAYA_WHIP`
  `static final Color`
  `PEACH_PUFF`
  `static final Color`
  `PERU`
  `static final Color`
  `PINK`
  `static final Color`
  `PLUM`
  `static final Color`
  `POWDER_BLUE`
  `static final Color`
  `PURPLE`
  `static final Color`
  `REBECCA_PURPLE`
  `static final Color`
  `RED`
  `static final Color`
  `ROSY_BROWN`
  `static final Color`
  `ROYAL_BLUE`
  `static final Color`
  `SADDLE_BROWN`
  `static final Color`
  `SALMON`
  `static final Color`
  `SANDY_BROWN`
  `static final Color`
  `SEA_GREEN`
  `static final Color`
  `SEASHELL`
  `static final Color`
  `SIENNA`
  `static final Color`
  `SILVER`
  `static final Color`
  `SLATE_BLUE`
  `static final Color`
  `SLATE_GRAY`
  `static final Color`
  `SNOW`
  `static final Color`
  `SPRING_GREEN`
  `static final Color`
  `STEEL_BLUE`
  `static final Color`
  `SYY_BLUE`
  `static final Color`
  `TAN`
  `static final Color`
  `TEAL`
  `static final Color`
  `THISTLE`
  `static final Color`
  `TOMATO`
  `static final Color`
  `TURQUOISE`
  `static final Color`
  `VIOLET`
  `static final Color`
  `WHEAT`
  `static final Color`
  `WHITE`
  `static final Color`
  `WHITE_SMOKE`
  `static final Color`
  `YELLOW`
  `static final Color`
  `YELLOW_GREEN`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Color`
  `getColor(String colorString)`
  Attempts to convert the given string into a color in a most flexible manner.
  `static Color`
  `getColorOrDefault(String value, Color defaultColor)`
  Tries to find a color for the given String value.
  `static String`
  `toColorName(Color color)`
  `static String`
  `toHexString(Color color)`
  Returns the hex value string for the given color
  `static String`
  `toRgbString(Color color)`
  Returns the rgb value string for the given color
  `static String`
  `toString(Color color)`
  Converts a color to a string value.
  `static String`
  `toString(Color color, boolean useNameIfPossible)`
  Converts a color to a string value.
  `static String`
  `toWebColorName(Color color)`
  Returns the WebColor name for the given color.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### BLACK

    public static final Color BLACK

  - ### NAVY

    public static final Color NAVY

  - ### DARK_BLUE

    public static final Color DARK_BLUE

  - ### MEDIUM_BLUE

    public static final Color MEDIUM_BLUE

  - ### BLUE

    public static final Color BLUE

  - ### DARK_GREEN

    public static final Color DARK_GREEN

  - ### GREEN

    public static final Color GREEN

  - ### 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_TURQUOSE

    public static final Color DARK_TURQUOSE

  - ### LIME

    public static final Color LIME

  - ### SPRING_GREEN

    public static final Color SPRING_GREEN

  - ### AQUA

    public static final Color AQUA

  - ### CYAN

    public static final Color CYAN

  - ### MIDNIGHT_BLUE

    public static final Color MIDNIGHT_BLUE

  - ### DOGER_BLUE

    public static final Color DOGER_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

  - ### 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

  - ### INDIGO

    public static final Color INDIGO

  - ### CADET_BLUE

    public static final Color CADET_BLUE

  - ### REBECCA_PURPLE

    public static final Color REBECCA_PURPLE

  - ### 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

  - ### 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

  - ### SYY_BLUE

    public static final Color SYY_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

  - ### LIGHT_BLUE

    public static final Color LIGHT_BLUE

  - ### GREEN_YELLOW

    public static final Color GREEN_YELLOW

  - ### PALE_TURQUOISE

    public static final Color PALE_TURQUOISE

  - ### POWDER_BLUE

    public static final Color POWDER_BLUE

  - ### FIRE_BRICK

    public static final Color FIRE_BRICK

  - ### DARK_GOLDENROD

    public static final Color DARK_GOLDENROD

  - ### 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

  - ### 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

  - ### 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

  - ### BURLYWOOD

    public static final Color BURLYWOOD

  - ### 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_GOLDENROD

    public static final Color PALE_GOLDENROD

  - ### LIGHT_CORAL

    public static final Color LIGHT_CORAL

  - ### KHAKE

    public static final Color KHAKE

  - ### 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

  - ### OLDLACE

    public static final Color OLDLACE

  - ### RED

    public static final Color RED

  - ### FUCHSIA

    public static final Color FUCHSIA

  - ### MAGENTA

    public static final Color MAGENTA

  - ### 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

  - ### LIGHT_PINK

    public static final Color LIGHT_PINK

  - ### PINK

    public static final Color PINK

  - ### GOLD

    public static final Color GOLD

  - ### PEACH_PUFF

    public static final Color PEACH_PUFF

  - ### NAVAJO_WHITE

    public static final Color NAVAJO_WHITE

  - ### 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

  - ### SEASHELL

    public static final Color SEASHELL

  - ### 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

  - ### MEDIUM_SPRING_GREEN

    public static final Color MEDIUM_SPRING_GREEN

  - ### LIGHT_GOLDENROD

    public static final Color LIGHT_GOLDENROD

  - ### MEDIUM_VIOLET_RED

    public static final Color MEDIUM_VIOLET_RED

  - ### LIGHT_STEEL_BLUE

    public static final Color LIGHT_STEEL_BLUE

  - ### LIGHT_SLATE_GRAY

    public static final Color LIGHT_SLATE_GRAY

  - ### MEDIUM_SLATE_BLUE

    public static final Color MEDIUM_SLATE_BLUE

  - ### MEDIUM_SEA_GREEN

    public static final Color MEDIUM_SEA_GREEN

  - ### MEDUM_AQUA_MARINE

    public static final Color MEDUM_AQUA_MARINE

  - ### MEDIUM_TURQOISE

    public static final Color MEDIUM_TURQOISE

  - ### DARK_OLIVE_GREEN

    public static final Color DARK_OLIVE_GREEN

  - ### CORNFLOWER_BLUE

    public static final Color CORNFLOWER_BLUE

- ## Method Details

  - ### getColorOrDefault

    public static Color getColorOrDefault(String value, Color defaultColor)
    Tries to find a color for the given String value. The String value can either be a hex string (see `Color.decode(String)`) or a web color name as defined above
    Parameters:
      `value` - the string value to interpret as a color
      `defaultColor` - a default color to return if the string can't be converted to a color
    Returns:
      a color for the given string value or the default color if the string can't be translated

  - ### toString

    public static String toString(Color color)
    Converts a color to a string value. If there is a defined color for the given color value, the color name will be returned. Otherwise, it will return a hex string for the color as follows. If the color has an non-opaque alpha value, it will be of the form #rrggbb. If it has an alpha value,then the format will be #rrggbbaa.
    Parameters:
      `color` - the color to convert to a string.
    Returns:
      the string representation for the given color.

  - ### toString

    public static String toString(Color color, boolean useNameIfPossible)
    Converts a color to a string value. If the color is a WebColor and the useNameIfPossible is true, the name of the color will be returned. OOtherwise, it will return a hex string for the color as follows. If the color has an non-opaque alpha value, it will be of the form #rrggbb. If it has an alpha value ,then the format will be #rrggbbaa.
    Parameters:
      `color` - the color to convert to a string.
      `useNameIfPossible` - if true, the name of the color will be returned if the color is a WebColor
    Returns:
      the string representation for the given color.

  - ### toColorName

    public static String toColorName(Color color)

  - ### toHexString

    public static String toHexString(Color color)
    Returns the hex value string for the given color
    Parameters:
      `color` - the color
    Returns:
      the string

  - ### toRgbString

    public static String toRgbString(Color color)
    Returns the rgb value string for the given color
    Parameters:
      `color` - the color
    Returns:
      the string

  - ### toWebColorName

    public static String toWebColorName(Color color)
    Returns the WebColor name for the given color. Returns null if the color is not a WebColor
    Parameters:
      `color` - the color to lookup a WebColor name.
    Returns:
      the WebColor name for the given color. Returns null if the color is not a WebColor

  - ### getColor

    public static Color getColor(String colorString)
    Attempts to convert the given string into a color in a most flexible manner. It first checks if the given string matches the name of a known web color as defined above. If so it returns that color. Otherwise it tries to parse the string in any one of the following formats:

         #rrggbb
         #rrggbbaa
         0xrrggbb
         0xrrggbbaa
         rgb(red, green, blue)
         rgba(red, green, alpha)

    In the hex digit formats, the hex digits "rr", "gg", "bb", "aa" represent the values for red, green, blue, and alpha, respectively. In the "rgb" and "rgba" formats the red, green, and blue values are all integers between 0-255, while the alpha value is a float value from 0.0 to 1.0.
    Parameters:
      `colorString` - the color name
    Returns:
      a color for the given string or null