1.16.5 Gradient Text Colors

Discussion in 'Spigot Plugin Development' started by Piesrgr8, Oct 31, 2020.

  1. Title says it all. But, what I am really wondering is since there is hex color support for 1.16, is it better to just hard code every color for each individual letter, or is there a method that is able to do the gradient automatically?
     
  2. A simple color-gradient could just be a linear interpolation of the colors. Since you can represent a color by an unsigned integer, let’s say the start-color is a and the end-color is b. A linear interpolation satisfies the equation f(x) = round(((b-a)/c)*n) + a
    Where n is the length of the char-array you want to color.