From 3c000a121f1634374b7e4c082e1d84017378f915 Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 7 Dec 2020 19:54:39 +0100 Subject: [PATCH] [banner] background --- server/routes/banner.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/routes/banner.js b/server/routes/banner.js index 3f73efd7..339bd307 100644 --- a/server/routes/banner.js +++ b/server/routes/banner.js @@ -40,9 +40,8 @@ router.get('/banner/:pronounName*.png', async (req, res) => { const canvas = createCanvas(width, height) const context = canvas.getContext('2d') - context.fillStyle = '#fff' - context.fillRect(0, 0, width, height) - context.fillStyle = '#000' + const bg = await loadImage('static/bg.png'); + context.drawImage(bg, 0, 0, width, height); const fallback = async _ => { const logo = await loadImage('node_modules/@fortawesome/fontawesome-pro/svgs/light/tags.svg'); @@ -93,7 +92,8 @@ router.get('/banner/:pronounName*.png', async (req, res) => { context.font = 'regular 48pt Quicksand' context.fillText(translations.pronouns.intro + ':', width / leftRatio + imageSize / 1.5, height / 2 - 36) - const pronounNameOptions = pronounName === req.config.pronouns.any ? [req.config.pronouns.any] : pronoun.nameOptions(); + let pronounNameOptions = pronounName === req.config.pronouns.any ? [req.config.pronouns.any] : pronoun.nameOptions(); + pronounNameOptions = pronounNameOptions.map(x => x.replace('/themself', '').replace('/themselves', '')); context.font = `bold ${pronounNameOptions.length <= 2 ? '70' : '36'}pt Quicksand` context.fillText(pronounNameOptions.join('\n'), width / leftRatio + imageSize / 1.5, height / 2 + (pronounNameOptions.length <= 2 ? 72 : 24))