How to use the red function from chalk
Find comprehensive JavaScript chalk.red code examples handpicked from public code repositorys.
GitHub: kevva/chalk
48 49 50 51 52 53 54 55 56
```js const chalk = require('chalk'); const log = console.log; // Combine styled and normal strings log(chalk.blue('Hello') + 'World' + chalk.red('!')); // Compose multiple styles using the chainable API log(chalk.blue.bgRed.bold('Hello world!'));
837
2
4
+ 3 other calls in file
48 49 50 51 52 53 54 55 56
```js const chalk = require('chalk'); const log = console.log; // Combine styled and normal strings log(chalk.blue('Hello') + ' World' + chalk.red('!')); // Compose multiple styles using the chainable API log(chalk.blue.bgRed.bold('Hello world!'));
837
0
3
GitHub: xaboy/form-create
41 42 43 44 45 46 47 48 49 50
spinner.text = packageCreateBuildingTips + '\n'; args.packages.forEach((scope) => { const isExists = fs.existsSync(context + '/packages/' + scope) /// check packages folder exists package if (!isExists) { spinner.fail(packageCreateFinishErrorTips + chalk.red.bold(`In the packages folder no [${scope}] package name, Please check packages folder have [${scope}] name.`)) exit(1) } }) /// building
818
0
96
GitHub: iptv-org/iptv
80 81 82 83 84 85 86 87 88 89
warnings = warnings.concat(fileLog.filter(e => e.type === 'warning')) } } logger.error( chalk.red( `\n${errors.length + warnings.length} problems (${errors.length} errors, ${ warnings.length } warnings)` )
427
0
0
+ 3 other calls in file
GitHub: mkbug-com/mkbug.js
59 60 61 62 63 64 65 66
}, WARN(msg, ...other) { isTest && console.warn(chalk.magenta('Mkbug.js [ WARN]:'), chalk.magenta(msg), ...other); }, ERROR(msg, ...other) { isTest && console.error(chalk.red('Mkbug.js [ERROR]:'), chalk.red(msg), ...other); } };
2
23
3
+ 5 other calls in file
GitHub: alsotang/PM2
179 180 181 182 183 184 185 186 187 188
break; case 'launching': return chalk.blue.bold('launching'); break; default: return chalk.red.bold(status); } } /**
0
5
0
113 114 115 116 117 118 119 120 121 122
log: (...messages) => { console.log('🔘 ', chalk.gray(messages)); }, error: (...messages) => { console.error('🔴 ', chalk.red(messages)); } }; const self = {
225
741
35
3 4 5 6 7 8 9 10 11 12
const isEmpty = require('lodash/isEmpty'); const identity = require('lodash/identity'); const chalk = require('chalk'); // Translates strings like 'red, underline, bold' // into function chalk.red.underline.bold(text) function buildStylingFunction(styles) { if (isEmpty(styles)) { return identity; }
73
402
15
1 2 3 4 5 6 7 8 9 10
chalk.enabled = process.env.NODE_ENV !== 'test' module.exports.successStyle = chalk.green module.exports.warningStyle = chalk.yellow module.exports.errorStyle = chalk.red module.exports.highlightStyle = chalk.cyan module.exports.headingStyle = chalk.cyan.bold module.exports.codeStyle = chalk.dim module.exports.pathStyle = chalk.cyan.underline
60
301
72
498 499 500 501 502 503 504 505 506 507
string += ` ${chalk.bgBlue('User:')} `; string += `${this.tag} (${this.id})\n`; string += ` ${chalk.bgGreen('Avatar URL:')} `; string += chalk.cyan(`${this.avatarURL}\n`); string += ` ${chalk.bgMagenta('Token:')} `; string += chalk.red(`${this.token ? this.token : 'Unknown'}`); RemoteAuth._logger('default', string); } }
65
302
10
+ 2 other calls in file
GitHub: eggjs/egg-logger
75 76 77 78 79 80 81 82 83
if (!chalk.supportsColor) { return msg; } if (meta.level === 'ERROR') { return chalk.red(msg); } else if (meta.level === 'WARN') { return chalk.yellow(msg); }
42
142
24
GitHub: ecomfe/santd
71 72 73 74 75 76 77 78 79 80
type: 'confirm', name: 'needtochange', message: chalk.gray('confirm git config:') + '\n\tuser.name: ' + chalk.green(name.stdout) + '\n\tuser.email: ' + chalk.green(email.stdout) + chalk.red('\nDo you need to make any changes?'), default: false }, { type: 'input',
41
72
24
+ 5 other calls in file
GitHub: esatterwhite/skyring
4 5 6 7 8 9 10 11 12 13
const formats = { create: chalk.cyan.bold , replace: chalk.blue , execute: chalk.blue.bold , cancel: chalk.yellow.bold , fail: chalk.red , success: chalk.green.bold , shutdown: chalk.bgYellow.white , ready: chalk.bgGreen.white.bold , recover: chalk.bgMagenta.bold
3
28
3
+ 3 other calls in file
70 71 72 73 74 75 76 77 78 79
messages = messages.filter((m) => m[2] === "error"); } // add color to rule keywords messages.forEach((m) => { m[4] = m[2] === "error" ? chalk.red(m[4]) : chalk.yellow(m[4]); m.splice(2, 1); }); let outputTable = table(messages, {
38
53
0
262 263 264 265 266 267 268 269 270 271
// It allows us to log custom error messages on the console. function onProxyError(proxy) { return (err, req, res) => { const host = req.headers && req.headers.host; console.log( chalk.red("Proxy error:") + " Could not proxy request " + chalk.cyan(req.url) + " from " + chalk.cyan(host) +
38
53
0
+ 5 other calls in file
25 26 27 28 29 30 31 32 33 34
path += `/${runOptions.component}`; } console.log( '\n-------------- ' + chalk.red.bold.underline.bgBlack( ` ${runOptions.test}.${runOptions.scenario} `, ) + ' --------------\n', );
28
177
0
GitHub: Yakashi13/Yaka-bot
442 443 444 445 446 447 448 449 450 451
chalk.white(chalk.bgRed("[ MESSAGE ]")), chalk.black(chalk.bgYellow(new Date())), chalk.yellow(chalk.bgGrey(budy || m.mtype)) + "\n" + chalk.blue("=> From"), chalk.red(pushname), chalk.green(m.sender) + "\n" + chalk.blueBright("=> In"), chalk.white(m.isGroup ? m.from : "Private Chat", m.chat) ); }
8
5
0
+ 2 other calls in file
GitHub: Keyteq/frontend-packages
56 57 58 59 60 61 62 63 64
function removeBuildFile(file, dest) { const destPath = resolveDestPath(file, dest); fs.unlinkSync(destPath); process.stdout.write( `${chalk.red('\u2022 ') + chalk.red('Deleted \u21D2 ') + path.relative(PACKAGES_DIR, destPath)}\n`, ); }
5
1
7
+ 3 other calls in file
75 76 77 78 79 80 81 82 83 84
### API * 1.chalk.<style>[.<style>...](string, [string...]) ``` Example: chalk.red.bold.underline('Hello', 'world'); ``` * 2.chalk.enabled ```
15
38
3
+ 3 other calls in file
116 117 118 119 120 121 122 123 124 125
const filledBar = Math.floor(ratio * MAX_PROGRESS_BAR_CHAR_WIDTH); const bundleTypeColor = phase === 'done' ? chalk.green : phase === 'failed' ? chalk.red : chalk.yellow; const progress = phase === 'in_progress' ? chalk.green.bgGreen(DARK_BLOCK_CHAR.repeat(filledBar)) +
623
0
98
+ 5 other calls in file