tag api update
This commit is contained in:
+5
-4
@@ -39,7 +39,7 @@ router.get('/tag', (req, res) => {
|
|||||||
<g fill="#fff" text-anchor="start" font-family="${fontFamily}" text-rendering="geometricPrecision" font-size="${badgeFontSize}">
|
<g fill="#fff" text-anchor="start" font-family="${fontFamily}" text-rendering="geometricPrecision" font-size="${badgeFontSize}">
|
||||||
<text x="${tagTextX}" y="${badgeFontSize + textPadding}" fill="${color}">${tag.toLowerCase()}</text>
|
<text x="${tagTextX}" y="${badgeFontSize + textPadding}" fill="${color}">${tag.toLowerCase()}</text>
|
||||||
<text x="${labelTextX}" y="${badgeFontSize + textPadding}" fill="${color}" font-weight="${fontWeight}">${label.toUpperCase()}</text>
|
<text x="${labelTextX}" y="${badgeFontSize + textPadding}" fill="${color}" font-weight="${fontWeight}">${label.toUpperCase()}</text>
|
||||||
</g>`;
|
</g>`.trim();
|
||||||
|
|
||||||
|
|
||||||
const flat = `
|
const flat = `
|
||||||
@@ -60,12 +60,13 @@ router.get('/tag', (req, res) => {
|
|||||||
<text x="165" y="140" transform="scale(.1)" fill="#fff" textLength="210">${tag}</text>
|
<text x="165" y="140" transform="scale(.1)" fill="#fff" textLength="210">${tag}</text>
|
||||||
<text aria-hidden="true" x="455" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">${label}</text>
|
<text aria-hidden="true" x="455" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">${label}</text>
|
||||||
<text x="455" y="140" transform="scale(.1)" fill="#fff" textLength="210">${label}</text>
|
<text x="455" y="140" transform="scale(.1)" fill="#fff" textLength="210">${label}</text>
|
||||||
</g>`;
|
</g>`.trim();
|
||||||
|
|
||||||
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${badgeWidth}" height="${badgeSize}" role="img" aria-label="${tag}: ${label}">
|
const svg = `
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="${badgeWidth}" height="${badgeSize}" role="img" aria-label="${tag}: ${label}">
|
||||||
<title>${tag}: ${label}</title>
|
<title>${tag}: ${label}</title>
|
||||||
${style === 'rect' ? rect : flat}
|
${style === 'rect' ? rect : flat}
|
||||||
</svg>`;
|
</svg>`.trim();
|
||||||
|
|
||||||
res.setHeader('Content-Type', 'image/svg+xml');
|
res.setHeader('Content-Type', 'image/svg+xml');
|
||||||
res.send(svg);
|
res.send(svg);
|
||||||
|
|||||||
Reference in New Issue
Block a user