Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Video-Downloader/api/src/misc/console-text.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
36 lines (29 sloc)
640 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ANSI = { | |
RESET: "\x1b[0m", | |
BRIGHT: "\x1b[1m", | |
RED: "\x1b[31m", | |
GREEN: "\x1b[32m", | |
CYAN: "\x1b[36m", | |
YELLOW: "\x1b[93m" | |
} | |
function wrap(color, text) { | |
if (!ANSI[color.toUpperCase()]) { | |
throw "invalid color"; | |
} | |
return ANSI[color.toUpperCase()] + text + ANSI.RESET; | |
} | |
export function Bright(text) { | |
return wrap('bright', text); | |
} | |
export function Red(text) { | |
return wrap('red', text); | |
} | |
export function Green(text) { | |
return wrap('green', text); | |
} | |
export function Cyan(text) { | |
return wrap('cyan', text); | |
} | |
export function Yellow(text) { | |
return wrap('yellow', text); | |
} |