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.

@FunctionalInterface public interface ColorFilter extends UnaryOperator<org.bukkit.Color>
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 Details

    • andThen

      default ColorFilter andThen(ColorFilter after)
      Composes this filter with another. The result of this filter is passed as the input to the after filter.
      Parameters:
      after - The filter to apply after this one.
      Returns:
      A composed ColorFilter.
    • grayscale

      static ColorFilter grayscale()
      Creates a filter that converts colors to grayscale.

      Formula: (R + G + B) / 3

      Returns:
      A grayscale ColorFilter.
    • invert

      static ColorFilter invert()
      Creates a filter that inverts the RGB components of a color.

      Formula: 255 - Component

      Returns:
      An inversion ColorFilter.
    • sepia

      static 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

      static ColorFilter brightness(float factor)
      Creates a filter that adjusts the brightness of a color.
      Parameters:
      factor - The brightness multiplier. Values > 1.0 brighten, values < 1.0 darken.
      Returns:
      A brightness adjustment ColorFilter.
    • saturation

      static ColorFilter saturation(float factor)
      Creates a filter that adjusts the saturation of a color.
      Parameters:
      factor - The saturation multiplier. Values > 1.0 increase intensity, values < 1.0 desaturate.
      Returns:
      A saturation adjustment ColorFilter.
    • contrast

      static ColorFilter contrast(float factor)
      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.0 increase contrast, values < 1.0 decrease it.
      Returns:
      A contrast adjustment ColorFilter.
    • tint

      static ColorFilter tint(org.bukkit.Color tint, double intensity)
      Creates a filter that applies a color tint to the input.
      Parameters:
      tint - The Color to apply as a tint.
      intensity - The strength of the tint (0.0 to 1.0).
      Returns:
      A tinting ColorFilter.
    • colorBlindness

      static ColorFilter colorBlindness(ColorBlindness type)
      Creates a filter that simulates specific types of color blindness.
      Parameters:
      type - The ColorBlindness simulation type to apply.
      Returns:
      A simulation ColorFilter.