Package ghidra.util

Class ColorUtils

java.lang.Object
ghidra.util.ColorUtils

public class ColorUtils extends Object
  • Field Details

  • Constructor Details

    • ColorUtils

      public ColorUtils()
  • Method Details

    • deriveBackground

      public static Color deriveBackground(Color src, float hue, float sfact, float bfact)
    • deriveBackground

      public static Color deriveBackground(Color background, float hue)
    • deriveForeground

      public static Color deriveForeground(Color bg, float hue, float brt)
    • deriveForeground

      public static Color deriveForeground(Color bg, float hue)
    • contrastForegroundColor

      public static Color contrastForegroundColor(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 Color blend(Color c1, 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 color
      c2 - the second color
      ratio - the amount of the first color to include in the final output
      Returns:
      the new color