Class Gradient<T extends Color>

java.lang.Object
org.strassburger.colorlab4j.gradients.Gradient<T>
Direct Known Subclasses:
HSLGradient, HSVGradient, LABGradient, RGBGradient, XYZGradient

public abstract class Gradient<T extends Color> extends Object
  • Field Details

    • colors

      public final List<T extends Color> colors
  • Constructor Details

    • Gradient

      public Gradient(List<T> colors)
      Create a new gradient
      Parameters:
      colors - The list of colors that define the gradient
    • Gradient

      public Gradient(T start, T end)
      Create a new gradient
      Parameters:
      start - The start color
      end - The end color
    • Gradient

      @SafeVarargs public Gradient(T... colors)
      Create a new gradient
      Parameters:
      colors - The colors that define the gradient
  • Method Details

    • getColors

      public List<T> getColors(int steps)
      Get the colors of the gradient (including the start and end color)
      Parameters:
      steps - The number of steps (excluding the start and end color)
      Returns:
      The colors of the gradient
    • getColors

      public abstract List<T> getColors(int steps, boolean includeStartAndEnd)
      Get the colors of the gradient
      Parameters:
      steps - The number of steps
      includeStartAndEnd - Whether to include the start and end color
      Returns:
      The colors of the gradient
    • printGradient

      public void printGradient(int steps)
      Print the gradient
      Parameters:
      steps - The number of steps