ashleywillis
Version:
Ashley Willis' terminal business card
52 lines (44 loc) • 2.32 kB
JavaScript
const chalk = require('chalk');
// Define colors and styles
const primary = chalk.hex('#36D1DC'); // Vibrant teal for borders
const secondary = chalk.hex('#FF6B6B'); // Coral pink for brackets
const accent = chalk.hex('#58D68D'); // Bright green for URLs
const subtle = chalk.hex('#AEB6BF'); // Subtle gray for dividers
const highlight = chalk.hex('#FFDB58').bold; // Golden yellow for name
// Card dimensions - fixed width for better alignment
const width = 54;
// Create borders with exact width
const topBorder = primary('╭' + '─'.repeat(width) + '╮');
const bottomBorder = primary('╰' + '─'.repeat(width) + '╯');
// Function to create a line with perfectly aligned borders
const createLine = (text) => {
// Strip ANSI codes for accurate length calculation
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(' ' + subtle('━'.repeat(width - 2)) + ' ');
// Build the card with precise spacing
const card = [
'',
topBorder,
emptyLine,
createLine(' ' + secondary('{') + highlight('Ashley Willis') + secondary('}') + ' ' + primary('</') + accent('ashley.dev') + primary('>')),
divider,
emptyLine,
createLine(' ' + secondary('⚙') + ' ' + chalk.cyanBright('Work') + ' :: ' + chalk.white('Sr. Dir. of DevRel @ GitHub')),
createLine(' ' + accent('☁') + ' ' + chalk.cyanBright('Bluesky') + ' :: ' + chalk.cyan('@ashley.dev')),
createLine(' ' + highlight('★') + ' ' + chalk.cyanBright('GitHub') + ' :: ' + chalk.greenBright.underline('https://github.com/ashleymcnamara')),
createLine(' ' + chalk.magentaBright('✉') + ' ' + chalk.cyanBright('Email') + ' :: ' + chalk.greenBright.underline('hello@ashley.dev')),
createLine(' ' + chalk.blueBright('⌂') + ' ' + chalk.cyanBright('Web') + ' :: ' + chalk.greenBright.underline('https://ashley.dev')),
emptyLine,
divider,
createLine(' ' + subtle('>') + ' ' + subtle('Run') + ' ' + secondary('npx') + ' ' + highlight('ashleywillis') + ' ' + subtle('anytime to see this card')),
emptyLine,
bottomBorder,
''
].join('\n');
console.log(card);