Package ghidra.util
Class ColorUtils
- java.lang.Object
-
- ghidra.util.ColorUtils
-
public class ColorUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static float
HUE_BLUE
static float
HUE_GREEN
static float
HUE_LIME
static float
HUE_ORANGE
static float
HUE_PINE
static float
HUE_PINK
static float
HUE_PURPLE
static float
HUE_RED
static float
HUE_ROYAL
static float
HUE_SAPPHIRE
static float
HUE_TURQUISE
static float
HUE_YELLOW
-
Constructor Summary
Constructors Constructor Description ColorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.Color
blend(java.awt.Color c1, java.awt.Color c2, float ratio)
Takes the first color, blending into it the second color, using the given ratio.static java.awt.Color
contrastForegroundColor(java.awt.Color color)
A method to produce a color (either black or white) that contrasts with the given color.static java.awt.Color
deriveBackground(java.awt.Color background, float hue)
static java.awt.Color
deriveBackground(java.awt.Color src, float hue, float sfact, float bfact)
static java.awt.Color
deriveForeground(java.awt.Color bg, float hue)
static java.awt.Color
deriveForeground(java.awt.Color bg, float hue, float brt)
-
-
-
Field Detail
-
HUE_RED
public static final float HUE_RED
- See Also:
- Constant Field Values
-
HUE_ORANGE
public static final float HUE_ORANGE
- See Also:
- Constant Field Values
-
HUE_YELLOW
public static final float HUE_YELLOW
- See Also:
- Constant Field Values
-
HUE_LIME
public static final float HUE_LIME
- See Also:
- Constant Field Values
-
HUE_GREEN
public static final float HUE_GREEN
- See Also:
- Constant Field Values
-
HUE_PINE
public static final float HUE_PINE
- See Also:
- Constant Field Values
-
HUE_TURQUISE
public static final float HUE_TURQUISE
- See Also:
- Constant Field Values
-
HUE_SAPPHIRE
public static final float HUE_SAPPHIRE
- See Also:
- Constant Field Values
-
HUE_BLUE
public static final float HUE_BLUE
- See Also:
- Constant Field Values
-
HUE_ROYAL
public static final float HUE_ROYAL
- See Also:
- Constant Field Values
-
HUE_PURPLE
public static final float HUE_PURPLE
- See Also:
- Constant Field Values
-
HUE_PINK
public static final float HUE_PINK
- See Also:
- Constant Field Values
-
-
Method Detail
-
deriveBackground
public static java.awt.Color deriveBackground(java.awt.Color src, float hue, float sfact, float bfact)
-
deriveBackground
public static java.awt.Color deriveBackground(java.awt.Color background, float hue)
-
deriveForeground
public static java.awt.Color deriveForeground(java.awt.Color bg, float hue, float brt)
-
deriveForeground
public static java.awt.Color deriveForeground(java.awt.Color bg, float hue)
-
contrastForegroundColor
public static java.awt.Color contrastForegroundColor(java.awt.Color color)
A method to produce a color (either black or white) that contrasts with the given color. This is useful for finding a readable foreground color for a given background.- Parameters:
color
- the color for which to find a contrast.- Returns:
- the contrasting color.
-
blend
public static java.awt.Color blend(java.awt.Color c1, java.awt.Color c2, float ratio)
Takes the first color, blending into it the second color, using the given ratio. A lower ratio (say .1f) signals to use very little of the first color; a larger ratio signals to use more of the first color.- Parameters:
c1
- the first colorc2
- the second colorratio
- the amount of the first color to include in the final output- Returns:
- the new color
-
-