java.lang.Object
io.jenkins.plugins.coverage.model.visualization.colorization.ColorProvider

public class ColorProvider extends Object
Loads a color palette and provides these colors and operations on them. The colors are provided as a tuple of fill color and line color, mapped by the id of the fill color.
Autor:
Florian Orendi
  • Felddetails

    • DEFAULT_COLOR

      public static final ColorProvider.DisplayColors DEFAULT_COLOR
      Default color that is provided if no color is found in order to guarantee a proper colorization.
  • Methodendetails

    • blendColors

      public static Color blendColors(Color color1, Color color2)
      Blends two colors.
      Parameter:
      color1 - The first color
      color2 - The second color
      Gibt zurück:
      the blended color
    • blendWeightedColors

      public static Color blendWeightedColors(@NonNull Color color1, @NonNull Color color2, double weight1, double weight2)
      Blends two colors using weights that have to be greater then zero.
      Parameter:
      color1 - The first color
      color2 - The second color
      weight1 - The weight of the first color
      weight2 - The weight of the second color
      Gibt zurück:
      the blended color
    • colorAsRGBAHex

      public static String colorAsRGBAHex(Color color, int alpha)
      Provides the RGBA hex string of the passed color.
      Parameter:
      color - The Color
      alpha - The alpha value within the range [0;255]
      Gibt zurück:
      the color as a hex string
    • colorAsRGBHex

      public static String colorAsRGBHex(Color color)
      Provides the RGB hex string of the passed color.
      Parameter:
      color - The Color
      Gibt zurück:
      the color as a hex string
    • getDisplayColorsOf

      public ColorProvider.DisplayColors getDisplayColorsOf(ColorId colorId)
      Returns the display colors for the passed id.
      Parameter:
      colorId - The ID of the fill color
      Gibt zurück:
      the display colors or the default color if no color has been found
    • containsColorId

      public boolean containsColorId(ColorId colorId)
      Checks whether the provider contains display colors for the passed id.
      Parameter:
      colorId - The color id that should be checked
      Gibt zurück:
      true whether the id is available, else false
    • getBlendedDisplayColors

      public ColorProvider.DisplayColors getBlendedDisplayColors(double weightFirst, double weightSecond, ColorId first, ColorId second)
      Gets the blended display colors in dependence of the passed weights for each colors.
      Parameter:
      weightFirst - The weight of the first colors
      weightSecond - The weight of the second colors
      first - The first display colors
      second - The second display colors
      Gibt zurück:
      the blended display colors or the DEFAULT_COLOR if one color has not been found