mirror of https://github.com/beemdevelopment/Aegis
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
550 B
Java
21 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);
|
|
}
|
|
}
|