mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 22:12:55 +00:00
20 lines
550 B
Java
20 lines
550 B
Java
package me.impy.aegis.helpers;
|
|
|
|
import com.amulyakhare.textdrawable.TextDrawable;
|
|
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
|
|
|
public class TextDrawableHelper {
|
|
private TextDrawableHelper() {
|
|
|
|
}
|
|
|
|
public static TextDrawable generate(String s) {
|
|
if (s == null || s.length() <= 1) {
|
|
return null;
|
|
}
|
|
|
|
ColorGenerator generator = ColorGenerator.MATERIAL;
|
|
int color = generator.getColor(s);
|
|
return TextDrawable.builder().buildRound(s.substring(0, 1).toUpperCase(), color);
|
|
}
|
|
}
|