Fix avatar from name to support lowercase
This commit is contained in:
parent
e3750ef471
commit
72d1695612
5 changed files with 13 additions and 9 deletions
|
@ -101,15 +101,14 @@ export async function avatarDataToBytes(
|
|||
);
|
||||
} else if (color && text) {
|
||||
const { bg, fg } = getAvatarColor(color);
|
||||
const textToWrite = text.toLocaleUpperCase();
|
||||
|
||||
setCanvasBackground(bg, context, canvas);
|
||||
context.fillStyle = fg;
|
||||
const font = await getFont(textToWrite);
|
||||
const font = await getFont(text);
|
||||
context.font = font;
|
||||
context.textBaseline = 'middle';
|
||||
context.textAlign = 'center';
|
||||
context.fillText(textToWrite, CANVAS_SIZE / 2, CANVAS_SIZE / 2 + 30);
|
||||
context.fillText(text, CANVAS_SIZE / 2, CANVAS_SIZE / 2 + 30);
|
||||
} else if (color && icon) {
|
||||
const iconPath = `images/avatars/avatar_${icon}.svg`;
|
||||
await drawImage(iconPath, context, canvas);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue