7900 shaares
161 private links
161 private links
Using JS to generate a default avatar with one letter:
function genAvatar(name) {
try {
// Match General_Category=Letter
const match = name.match(/\p{L}/u);
return (match && match[0]) || null;
} catch {
return name[0] || null;
}
}