UNPKG

npx-tai

Version:

Tai Nguyen's business card

41 lines (36 loc) 1.15 kB
const chalk = require('chalk'); const boxen = require('boxen'); const data = require('./lib/data'); const formatCard = () => { // Colors const nameColor = chalk.bold.green; const titleColor = chalk.white; const labelColor = chalk.gray; const linkColor = chalk.cyan; const messageColor = chalk.white; // Format the card content const content = [ `${nameColor(data.name)}`, ``, `${labelColor('Work:')} ${titleColor(data.title)}`, ``, `${labelColor('Web:')} ${linkColor(data.website)}`, `${labelColor('GitHub:')} ${linkColor(data.social.github)}`, `${labelColor('LinkedIn:')} ${linkColor(data.social.linkedin)}`, `${labelColor('Instagram:')} ${linkColor(data.social.instagram)}`, `${labelColor('Phone:')} ${linkColor(data.phone)}`, ``, `${messageColor(data.message)}` ].join('\n'); // Box options const boxOptions = { padding: 1, margin: 1, borderStyle: 'round', borderColor: 'green', float: 'center' }; // Return the formatted card return boxen.default(content, boxOptions); }; module.exports = formatCard;