UNPKG

haiku-bloom

Version:

A delightful CLI tool that generates beautiful haikus 🌸

123 lines (113 loc) • 2.51 kB
#!/usr/bin/env node const haikus = [ { lines: [ "Cherry blossoms fall", "Soft petals dance on spring breeze", "New beginnings bloom" ] }, { lines: [ "Morning dew glistens", "On leaves that whisper secrets", "Nature's quiet song" ] }, { lines: [ "Stars peek through dark clouds", "Silent witnesses above", "Dreams take gentle flight" ] }, { lines: [ "Ocean waves roll in", "Carrying tales from afar", "Sand holds memories" ] }, { lines: [ "Autumn leaves descend", "Golden carpet beneath trees", "Change paints the world new" ] }, { lines: [ "Moonlight on water", "Silver ripples tell stories", "Night embraces all" ] }, { lines: [ "Butterfly rests soft", "On flowers reaching for sun", "Beauty finds its way" ] }, { lines: [ "Rain taps on windows", "Rhythmic dance of nature's tears", "Earth drinks gratefully" ] }, { lines: [ "Mountain stands so tall", "Ancient wisdom in its stones", "Time flows like rivers" ] }, { lines: [ "Fireflies dance bright", "Summer night's magical show", "Wonder fills the air" ] } ]; const colors = { reset: '\x1b[0m', bright: '\x1b[1m', dim: '\x1b[2m', underscore: '\x1b[4m', blink: '\x1b[5m', reverse: '\x1b[7m', hidden: '\x1b[8m', fgBlack: '\x1b[30m', fgRed: '\x1b[31m', fgGreen: '\x1b[32m', fgYellow: '\x1b[33m', fgBlue: '\x1b[34m', fgMagenta: '\x1b[35m', fgCyan: '\x1b[36m', fgWhite: '\x1b[37m', bgBlack: '\x1b[40m', bgRed: '\x1b[41m', bgGreen: '\x1b[42m', bgYellow: '\x1b[43m', bgBlue: '\x1b[44m', bgMagenta: '\x1b[45m', bgCyan: '\x1b[46m', bgWhite: '\x1b[47m' }; function getRandomHaiku() { return haikus[Math.floor(Math.random() * haikus.length)]; } function displayHaiku() { const haiku = getRandomHaiku(); console.log('\n' + colors.fgMagenta + colors.bright + '🌸 Haiku Bloom 🌸' + colors.reset + '\n'); console.log(colors.dim + '─'.repeat(30) + colors.reset); haiku.lines.forEach((line, index) => { const indent = index === 1 ? ' ' : ''; console.log(colors.fgCyan + indent + line + colors.reset); }); console.log(colors.dim + '─'.repeat(30) + colors.reset); console.log('\n' + colors.dim + 'May this haiku bring you peace ✨' + colors.reset + '\n'); } displayHaiku();