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 floatHUE_BLUEstatic floatHUE_GREENstatic floatHUE_LIMEstatic floatHUE_ORANGEstatic floatHUE_PINEstatic floatHUE_PINKstatic floatHUE_PURPLEstatic floatHUE_REDstatic floatHUE_ROYALstatic floatHUE_SAPPHIREstatic floatHUE_TURQUISEstatic floatHUE_YELLOW
-
Constructor Summary
Constructors Constructor Description ColorUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.Colorblend(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.ColorcontrastForegroundColor(java.awt.Color color)A method to produce a color (either black or white) that contrasts with the given color.static java.awt.ColorderiveBackground(java.awt.Color background, float hue)static java.awt.ColorderiveBackground(java.awt.Color src, float hue, float sfact, float bfact)static java.awt.ColorderiveForeground(java.awt.Color bg, float hue)static java.awt.ColorderiveForeground(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
-
-