mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-14 14:02:49 +00:00
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);
|
||
|
}
|
||
|
}
|