best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
api/console-text: refactor
jj5ea23bee134d
diff --git a/api/src/misc/console-text.js b/api/src/misc/console-text.jsindex 6ce747d7..8df8fcc6 100644--- a/api/src/misc/console-text.js+++ b/api/src/misc/console-text.js@@ -1,23 +1,36 @@-function t(color, tt) {- return color + tt + "\x1b[0m"+const ANSI = {+ RESET: "\x1b[0m",+ BRIGHT: "\x1b[1m",+ RED: "\x1b[31m",+ GREEN: "\x1b[32m",+ CYAN: "\x1b[36m",+ YELLOW: "\x1b[93m"}-export function Bright(tt) {- return t("\x1b[1m", tt)+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(tt) {- return t("\x1b[31m", tt)+export function Red(text) {+ return wrap('red', text);}-export function Green(tt) {- return t("\x1b[32m", tt)+export function Green(text) {+ return wrap('green', text);}-export function Cyan(tt) {- return t("\x1b[36m", tt)+export function Cyan(text) {+ return wrap('cyan', text);}-export function Yellow(tt) {- return t("\x1b[93m", tt)+export function Yellow(text) {+ return wrap('yellow', text);}