Class ColorProvider
java.lang.Object
com.parasoft.findings.jenkins.coverage.api.metrics.color.ColorProvider
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.
- Author:
- Florian Orendi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWraps the fill color and the line color that should be used in order to visualize coverage values. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ColorProvider.DisplayColorsDefault color that is provided if no color is found in order to guarantee a proper colorization. -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorblendColors(Color color1, Color color2) Blends two colors.static ColorblendWeightedColors(Color color1, Color color2, double weight1, double weight2) Blends two colors using weights that have to be greater then zero.static StringcolorAsRGBAHex(Color color, int alpha) Provides the RGBA hex string of the passed color.static StringcolorAsRGBHex(Color color) Provides the RGB hex string of the passed color.booleancontainsColorId(ColorId colorId) Checks whether the provider containsdisplay colorsfor the passed id.getBlendedDisplayColors(double weightFirst, double weightSecond, ColorId first, ColorId second) Gets the blendeddisplay colorsin dependence of the passed weights for each colors.getDisplayColorsOf(ColorId colorId) Returns thedisplay colorsfor the passed id.
-
Field Details
-
DEFAULT_COLOR
Default color that is provided if no color is found in order to guarantee a proper colorization.
-
-
Method Details
-
blendColors
Blends two colors.- Parameters:
color1- The first colorcolor2- The second color- Returns:
- 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.- Parameters:
color1- The first colorcolor2- The second colorweight1- The weight of the first colorweight2- The weight of the second color- Returns:
- the blended color
-
colorAsRGBAHex
Provides the RGBA hex string of the passed color.- Parameters:
color- TheColoralpha- The alpha value within the range [0;255]- Returns:
- the color as a hex string
-
colorAsRGBHex
Provides the RGB hex string of the passed color.- Parameters:
color- TheColor- Returns:
- the color as a hex string
-
getDisplayColorsOf
Returns thedisplay colorsfor the passed id.- Parameters:
colorId- The ID of the fill color- Returns:
- the display colors or the
default colorif no color has been found
-
containsColorId
Checks whether the provider containsdisplay colorsfor the passed id.- Parameters:
colorId- The color id that should be checked- Returns:
truewhether the id is available, elsefalse
-
getBlendedDisplayColors
public ColorProvider.DisplayColors getBlendedDisplayColors(double weightFirst, double weightSecond, ColorId first, ColorId second) Gets the blendeddisplay colorsin dependence of the passed weights for each colors.- Parameters:
weightFirst- The weight of the first colorsweightSecond- The weight of the second colorsfirst- The first display colorssecond- The second display colors- Returns:
- the blended display colors or the
DEFAULT_COLORif one color has not been found
-