zachupstone
Version:
Zach U's business card
49 lines (40 loc) • 1.75 kB
JavaScript
import chalk from "chalk"
// Colours and styles
const primary = chalk.hex('#FF6EC7')
const titleColour = chalk.hex('#FF6B6B')
const dividerColour = chalk.hex('#CA99A1')
const categoryColour = chalk.hex('#8e44ad')
const domainColour = chalk.hex('#FF9F43');
const width = 60
// Create borders with exact width
const topBorder = primary('╭' + '─'.repeat(width) + '╮');
const bottomBorder = primary('╰' + '─'.repeat(width) + '╯');
const createLine = (text) => {
const cleanText = text.replace(/\u001b\[\d+(;\d+)*m/g, '');
const padding = width - cleanText.length;
return primary('│') + text + ' '.repeat(padding) + primary('│');
};
// Empty line and divider
const emptyLine = createLine(' '.repeat(width));
const divider = createLine(' ' + dividerColour('━'.repeat(width - 2)) + ' ');
const card = [
'',
topBorder,
emptyLine,
createLine(' ' + chalk.white('-- ') + titleColour('Zach Upstone') + chalk.white(' --')),
divider,
emptyLine,
createLine(' ' + categoryColour('Work') + ' -> ' + chalk.white('Product Developer @ Pugpig')),
createLine(' ' + categoryColour('Website') + ' -> ' + chalk.gray('https://') + domainColour('zupstn.com')),
createLine(' ' + categoryColour('GitHub') + ' -> ' + chalk.gray('https://github.com/') + domainColour('zu213')),
createLine(' ' + categoryColour('LinkedIn') + ' -> ' + chalk.gray('https://www.linkedin.com/in/') + domainColour('zachary-upstone')),
emptyLine,
createLine(' ' + categoryColour('Card') + ' -> ' + chalk.redBright('npx') + chalk.white(' zachupstone')),
emptyLine,
divider,
emptyLine,
bottomBorder,
''
].join('\n');
console.log(card);