Interface ColorFilter
- All Superinterfaces:
Function<org.bukkit.Color, org.bukkit.Color>, UnaryOperator<org.bukkit.Color>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A functional interface representing a transformation applied to a
Color.
Color filters are used to modify color properties such as brightness, saturation, or to apply complex effects like sepia and color-blindness simulation.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ColorFilterandThen(ColorFilter after) Composes this filter with another.static ColorFilterbrightness(float factor) Creates a filter that adjusts the brightness of a color.static ColorFiltercolorBlindness(ColorBlindness type) Creates a filter that simulates specific types of color blindness.static ColorFiltercontrast(float factor) Creates a filter that adjusts the contrast of a color.static ColorFilterCreates a filter that converts colors to grayscale.static ColorFilterinvert()Creates a filter that inverts the RGB components of a color.static ColorFiltersaturation(float factor) Creates a filter that adjusts the saturation of a color.static ColorFiltersepia()Creates a filter that applies a sepia tone effect.static ColorFiltertint(org.bukkit.Color tint, double intensity) Creates a filter that applies a color tint to the input.
-
Method Details
-
andThen
Composes this filter with another. The result of this filter is passed as the input to theafterfilter.- Parameters:
after- The filter to apply after this one.- Returns:
- A composed
ColorFilter.
-
grayscale
Creates a filter that converts colors to grayscale.Formula:
(R + G + B) / 3- Returns:
- A grayscale
ColorFilter.
-
invert
Creates a filter that inverts the RGB components of a color.Formula:
255 - Component- Returns:
- An inversion
ColorFilter.
-
sepia
Creates a filter that applies a sepia tone effect.Uses the standard W3C recommended coefficients for digital sepia conversion.
- Returns:
- A sepia
ColorFilter.
-
brightness
Creates a filter that adjusts the brightness of a color.- Parameters:
factor- The brightness multiplier. Values> 1.0brighten, values< 1.0darken.- Returns:
- A brightness adjustment
ColorFilter.
-
saturation
Creates a filter that adjusts the saturation of a color.- Parameters:
factor- The saturation multiplier. Values> 1.0increase intensity, values< 1.0desaturate.- Returns:
- A saturation adjustment
ColorFilter.
-
contrast
Creates a filter that adjusts the contrast of a color.Contrast is adjusted by moving the RGB components toward or away from the 0.5 (50%) midpoint.
- Parameters:
factor- The contrast factor. Values> 1.0increase contrast, values< 1.0decrease it.- Returns:
- A contrast adjustment
ColorFilter.
-
tint
Creates a filter that applies a color tint to the input.- Parameters:
tint- TheColorto apply as a tint.intensity- The strength of the tint (0.0 to 1.0).- Returns:
- A tinting
ColorFilter.
-
colorBlindness
Creates a filter that simulates specific types of color blindness.- Parameters:
type- TheColorBlindnesssimulation type to apply.- Returns:
- A simulation
ColorFilter.
-