Class Recolor

  • All Implemented Interfaces:

    
    public final class Recolor<S extends Drawable>
    extends DrawableOp
                        

    Changes the color of the component to the specified color. Supports animation and callback function on finish.

    If the color is a PolyColor.Gradient, this component's color will be changed to a gradient between the current color and the specified color.

    If the color is a PolyColor.Chroma, this component's color will be changed to a chroma color, keeping its current hue for consistency. Note: This will look wierd if the current color is a gradient, and the brightness, saturation and alpha are NOT animated, so will change instantly.

    Since:

    0.19.1

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Unit apply()
      Boolean unapply()
      • Methods inherited from class org.polyfrost.polyui.operations.DrawableOp

        add, remove
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Recolor

        Recolor(S drawable, PolyColor toColor, Animation animation, Function1<S, Unit> onFinish)
        Parameters:
        toColor - The color to change the component to.
        animation - The animation to use.
        onFinish - The callback function to execute when the color change animation finishes.