Created
October 14, 2022 10:37
-
-
Save ducaale/4b62bf1aa6b073abc390e240303cfb04 to your computer and use it in GitHub Desktop.
Generate Resumake logo using vercel/satori
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs/promises' | |
import satori from 'satori' | |
let html = { | |
type: 'div', | |
props: { | |
style: { | |
height: '100%', | |
width: '100%', | |
display: 'flex', | |
flexDirection: 'column', | |
alignItems: 'center', | |
justifyContent: 'center', | |
backgroundColor: 'rgb(20, 23, 29)', | |
fontSize: 54, | |
fontWeight: 600, | |
}, | |
children: [ | |
{ | |
type: 'span', | |
props: { | |
children: [ | |
{ | |
type: 'span', | |
props: { | |
style: { color: '#fff' }, | |
children: 'resu' | |
} | |
}, | |
{ | |
type: 'span', | |
props: { | |
style: { color: '#56c9aa' }, | |
children: 'make' | |
} | |
} | |
] | |
} | |
} | |
] | |
} | |
} | |
const fontArrayBuf = await fs.readFile('./NexaDemo-Bold.ttf') | |
const options = { | |
width: 260, | |
height: 70, | |
fonts: [ | |
{ | |
name: 'NexaDemo-Bold', | |
data: fontArrayBuf, | |
style: 'normal' | |
} | |
] | |
} | |
const svg = await satori(html, options) | |
console.log(svg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment