How to use the gray function from chalk

Find comprehensive JavaScript chalk.gray code examples handpicked from public code repositorys.

109
110
111
112
113
114
115
116
117
118
warn: (...messages) => {
  console.warn('🔵 ', chalk.yellow(messages));
},

log: (...messages) => {
  console.log('🔘 ', chalk.gray(messages));
},

error: (...messages) => {
  console.error('🔴 ', chalk.red(messages));
fork icon225
star icon741
watch icon35

91
92
93
94
95
96
97
98
99
100
}

const seq = (function (prev, pad = 8) {
  return (now) => {
    try {
      return chalk.gray(
        (prev > 0 ? `+${ms(now - prev)}` : '').padStart(pad, ' ')
      )
    } finally {
      prev = now
fork icon47
star icon718
watch icon30

+ 5 other calls in file

68
69
70
71
72
73
74
75
76
77

let answer1 = await inquirer.prompt([
    {
        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
fork icon41
star icon72
watch icon24

+ 5 other calls in file

69
70
71
72
73
74
75
76
77
78
// const stream = isError ? process.stderr : process.stdout;
const stream = isError ? console.error : console.log;

// Format
const content = format
  .replace('{timestamp}', chalk.gray(timestamp))
  .replace(
    '{tag}',
    bgTagColor ? chalk[bgTagColor][tagColor](logTag) : chalk[tagColor](logTag))
  .replace('{msg}', chalk[msgColor](msg));
fork icon11
star icon33
watch icon3

+ 3 other calls in file

131
132
133
134
135
136
137
138
139
140
        SynthetixBridgeEscrow.address,
        SynthetixBridgeToOptimism.address
);

console.log(
        gray(
                'Current allowance for bridge to spend bridge escrow SNX is',
                ethers.utils.formatEther(currentAllowance)
        )
);
fork icon572
star icon0
watch icon53

164
165
166
167
168
169
170
171
172
173
        data: data,
};

if (dryRun) {
        console.log(
                gray(`[DRY RUN] Would append owner action of the following:\n${stringify(ownerAction)}`)
        );
} else {
        appendOwnerAction(ownerAction);
}
fork icon572
star icon0
watch icon53

+ 3 other calls in file

120
121
122
123
124
125
126
127
128
129
if (state === 'paused') {
  return chalk.yellow(stateFormatted)
}

if (state === 'exited') {
  return chalk.gray(stateFormatted)
}

if (state === 'dead') {
  return chalk.red(stateFormatted)
fork icon159
star icon0
watch icon45

28
29
30
31
32
33
34
35
36
37
builder: yargs =>
  yargs.options({
    local: {
      alias: 'l',
      default: false,
      desc: chalk.gray(y18n.__('init.local')),
      nargs: 0,
      requiresArg: false,
      type: 'boolean'
    },
fork icon0
star icon2
watch icon0

+ 15 other calls in file

149
150
151
152
153
154
155
156
157
// Start server
start()
  .then(() => {
    // Snapshot
    console.log(
      chalk.gray(
        '  Type s + enter at any time to create a snapshot of the database',
      ),
    )
fork icon0
star icon0
watch icon1

+ 2 other calls in file

0
1
2
3
4
5
6
7
8
9
10
11
12
/* eslint-disable no-console */


const chalk = require('chalk');
const ip = require('ip');


const divider = chalk.gray('\n-----------------------------------');


/**
 * Logger middleware, you can customize it to make messages more personal
 */
fork icon0
star icon0
watch icon0

2
3
4
5
6
7
8
9
10
11
12
13
const color = (text, color) => {
    return !color ? chalk.yellow(text) : chalk.keyword(color)(text)
}


const bgcolor = (text, bgcolor) => {
	return !bgcolor ? chalk.gray(text) : chalk.bgKeyword(bgcolor)(text)
}


module.exports = {
	color,
fork icon0
star icon0
watch icon0

70
71
72
73
74
75
76
77
78
79
  console.log(m.error != null ? chalk.red(log) : m.isCommand ? chalk.yellow(log) : log)
}
if (m.messageStubParameters) console.log(m.messageStubParameters.map(jid => {
  jid = conn.decodeJid(jid)
  let name = conn.getName(jid)
  return chalk.gray(PhoneNumber('+' + jid.replace('@s.whatsapp.net', '')).getNumber('international') + (name ? ' ~' + name : ''))
}).join(', '))
if (/document/i.test(m.mtype)) console.log(`📄 ${m.msg.filename || m.msg.displayName || 'Document'}`)
else if (/ContactsArray/i.test(m.mtype)) console.log(`👨‍👩‍👧‍👦 ${' ' || ''}`)
else if (/contact/i.test(m.mtype)) console.log(`👨 ${m.msg.displayName || ''}`)
fork icon0
star icon0
watch icon0

+ 4 other calls in file

457
458
459
460
461
462
463
464
465
466
// return higher order function
return (percentComplete, remaining) => {
  percentComplete = chalk.white(` ${percentComplete}%`)

  // pluralize seconds remaining
  remaining = chalk.gray(`${remaining}s`)

  util.setTaskTitle(
    task,
    util.titleize(title, percentComplete, remaining),
fork icon0
star icon0
watch icon0

82
83
84
85
86
87
88
89
90
91
name: chalk.bold.green(`                  ${user_name}`),
// work: `${chalk.white("Software Engineer at")} ${chalk.hex("#2b82b2").bold("ClearTax")}`,
work: `${chalk.white(`${job_title}`)}`,
skills: `${chalk.white(`${skills}`)}`,
twitter: chalk.gray("https://twitter.com/") + chalk.cyan(`${twitter_username}`),
github: chalk.gray("https://github.com/") + chalk.green(`${github_username}`),
npx: chalk.red("npx") + " " + chalk.white(`${npx_card_handle}`),

labelWork: chalk.white.bold("       Work:"),
labelSkills: chalk.white.bold("     Skills:"),
fork icon0
star icon0
watch icon0

56
57
58
59
60
61
62
63
64
    });
    this._suitesDesc = chalk.bold.white(this._suitesDesc);
  }

  _traceTest({description}, status) {
    const desc = this._suitesDesc + chalk.gray(description) + chalk.gray(status ? ` [${status}]` : '');
    log.info({event: 'SPEC_STATE_CHANGE'}, desc);
  }
}
fork icon0
star icon0
watch icon1

113
114
115
116
117
118
119
120
121
122
let count = 0

const nums = () => {
  count += 1

  return chalk.gray(`(${count}/${uploads.length})`)
}

const send = (pathToFile, url) => {
  const success = () => {
fork icon0
star icon0
watch icon621