feat: add IridiumColorAPI utility for advanced text coloring and gradients
This commit is contained in:
@@ -171,6 +171,9 @@ public class IridiumColorAPI {
|
||||
*/
|
||||
private static ChatColor[] createRainbow(int step, float saturation) {
|
||||
ChatColor[] colors = new ChatColor[step];
|
||||
if (step <= 0) {
|
||||
return colors;
|
||||
}
|
||||
double colorStep = (1.00 / step);
|
||||
for (int i = 0; i < step; i++) {
|
||||
Color color = Color.getHSBColor((float) (colorStep * i), saturation, saturation);
|
||||
@@ -194,6 +197,13 @@ public class IridiumColorAPI {
|
||||
*/
|
||||
private static ChatColor[] createGradient(Color start, Color end, int step) {
|
||||
ChatColor[] colors = new ChatColor[step];
|
||||
if (step <= 0) {
|
||||
return colors;
|
||||
}
|
||||
if (step == 1) {
|
||||
colors[0] = SUPPORTS_RGB ? ChatColor.of(start) : getClosestColor(start);
|
||||
return colors;
|
||||
}
|
||||
int stepR = Math.abs(start.getRed() - end.getRed()) / (step - 1);
|
||||
int stepG = Math.abs(start.getGreen() - end.getGreen()) / (step - 1);
|
||||
int stepB = Math.abs(start.getBlue() - end.getBlue()) / (step - 1);
|
||||
|
||||
Reference in New Issue
Block a user