mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #3585 from SillyTavern/chalk-lib
Use chalk lib for console colorization
This commit is contained in:
17
src/util.js
17
src/util.js
@@ -14,6 +14,7 @@ import _ from 'lodash';
|
||||
import yauzl from 'yauzl';
|
||||
import mime from 'mime-types';
|
||||
import { default as simpleGit } from 'simple-git';
|
||||
import chalk from 'chalk';
|
||||
import { LOG_LEVELS } from './constants.js';
|
||||
|
||||
/**
|
||||
@@ -323,21 +324,7 @@ export function deepMerge(target, source) {
|
||||
return output;
|
||||
}
|
||||
|
||||
export const color = {
|
||||
byNum: (mess, fgNum) => {
|
||||
mess = mess || '';
|
||||
fgNum = fgNum === undefined ? 31 : fgNum;
|
||||
return '\u001b[' + fgNum + 'm' + mess + '\u001b[39m';
|
||||
},
|
||||
black: (mess) => color.byNum(mess, 30),
|
||||
red: (mess) => color.byNum(mess, 31),
|
||||
green: (mess) => color.byNum(mess, 32),
|
||||
yellow: (mess) => color.byNum(mess, 33),
|
||||
blue: (mess) => color.byNum(mess, 34),
|
||||
magenta: (mess) => color.byNum(mess, 35),
|
||||
cyan: (mess) => color.byNum(mess, 36),
|
||||
white: (mess) => color.byNum(mess, 37),
|
||||
};
|
||||
export const color = chalk;
|
||||
|
||||
/**
|
||||
* Gets a random UUIDv4 string.
|
||||
|
Reference in New Issue
Block a user