Skip to content

Instantly share code, notes, and snippets.

@ducaale
Created October 14, 2022 10:37
Show Gist options
  • Save ducaale/4b62bf1aa6b073abc390e240303cfb04 to your computer and use it in GitHub Desktop.
Save ducaale/4b62bf1aa6b073abc390e240303cfb04 to your computer and use it in GitHub Desktop.
Generate Resumake logo using vercel/satori
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