Build customizable SSH portfolio MVP
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
export const ESC = '\x1b[';
|
||||
export const colors = { cyan: 36, yellow: 33, green: 32, magenta: 35, blue: 34, white: 37, red: 31, brightBlack: 90 };
|
||||
export const color = (name, text) => `\x1b[${colors[name] || colors.cyan}m${text}\x1b[0m`;
|
||||
export const clear = '\x1b[2J\x1b[H';
|
||||
export function wrap(text, width = 78) {
|
||||
const out = []; for (const paragraph of String(text).split('\n')) { let line = ''; for (const word of paragraph.split(/\s+/)) { if (line && line.length + word.length + 1 > width) { out.push(line); line = word; } else line += (line ? ' ' : '') + word; } out.push(line); } return out;
|
||||
}
|
||||
Reference in New Issue
Block a user