How to use the kleur.bold function in kleur

To help you get started, we’ve selected a few kleur examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jamesgeorge007 / node-banner / index.js View on Github external
const indexOfSeparator = title.indexOf('-');

		if (indexOfSeparator === -1) {
			title = title.charAt(0).toUpperCase() + title.substr(1, title.length);
		} else {
			title =
				title.charAt(0).toUpperCase() +
				title.substr(1, indexOfSeparator - 1) +
				' ' +
				title.substr(indexOfSeparator + 1, title.length).toUpperCase();
		}
	}

	try {
		const data = await printTitle(title);
		console.log(kleur.bold()[titleColor](data));

		// TagLine is optional.

		if (
			typeof tagLine !== 'undefined' &&
			tagLine !== '' &&
			tagLine.trim().length > 0
		) {
			console.log(' ' + kleur.bold()[tagLineColor](tagLine));
		}
	} catch (error) {
		throw error;
	}
};
github terkelg / prompts / lib / elements / date.js View on Github external
render() {
    if (this.closed) return;
    if (this.firstRender) this.out.write(cursor.hide);
    else this.out.write(clear(this.outputText));
    super.render();

    // Print prompt
    this.outputText = [
      style.symbol(this.done, this.aborted),
      color.bold(this.msg),
      style.delimiter(false),
      this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), [])
          .join('')
    ].join(' ');

    // Print error
    if (this.error) {
      this.outputText += this.errorMsg.split('\n').reduce(
          (a, l, i) => a + `\n${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
    }

    this.out.write(erase.line + cursor.to(0) + this.outputText);
  }
}
github terkelg / prompts / lib / elements / autocompleteMultiselect.js View on Github external
render() {
    if (this.closed) return;
    if (this.firstRender) this.out.write(cursor.hide);
    super.render();

    // print prompt

    let prompt = [
      style.symbol(this.done, this.aborted),
      color.bold(this.msg),
      style.delimiter(false),
      this.renderDoneOrInstructions()
    ].join(' ');

    if (this.showMinError) {
      prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
      this.showMinError = false;
    }
    prompt += this.renderOptions(this.filteredOptions);

    this.out.write(this.clear + prompt);
    this.clear = clear(prompt);
  }
}
github Marwan01 / food-converter / node_modules / prompts / dist / elements / text.js View on Github external
render() {
    if (this.closed) return;

    if (!this.firstRender) {
      if (this.outputError) this.out.write(cursor.down(lines(this.outputError) - 1) + clear(this.outputError));
      this.out.write(clear(this.outputText));
    }

    super.render();
    this.outputError = '';
    this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);

    if (this.error) {
      this.outputError += this.errorMsg.split(`\n`).reduce((a, l, i) => a + `\n${i ? ' ' : figures.pointerSmall} ${color.red().italic(l)}`, ``);
    }

    this.out.write(erase.line + cursor.to(0) + this.outputText + cursor.save + this.outputError + cursor.restore);
  }
github sveltejs / sapper / src / cli.ts View on Github external
onfile: event => {
					const size_color = event.size > 150000 ? colors.bold().red : event.size > 50000 ? colors.bold().yellow : colors.bold().gray;
						const size_label = size_color(left_pad(pb(event.size), 10));

						const file_label = event.status === 200
							? event.file
							: colors.bold()[event.status >= 400 ? 'red' : 'yellow'](`(${event.status}) ${event.file}`);

						console.log(`${size_label}   ${file_label}`);
				}
			});
github sveltejs / sapper / src / cli.ts View on Github external
onfile: event => {
					const size_color = event.size > 150000 ? colors.bold().red : event.size > 50000 ? colors.bold().yellow : colors.bold().gray;
						const size_label = size_color(left_pad(pb(event.size), 10));

						const file_label = event.status === 200
							? event.file
							: colors.bold()[event.status >= 400 ? 'red' : 'yellow'](`(${event.status}) ${event.file}`);

						console.log(`${size_label}   ${file_label}`);
				}
			});
github lukeed / pwa / packages / cli / lib / watch.js View on Github external
let { key, cert, cacert } = tmp;
		let hasCA = Boolean(cacert);
		protocol = 'https';

		if (key && cert) {
			key = resolve(cwd, key);
			cert = resolve(cwd, cert);
			cacert = cacert && resolve(cwd, cacert);
			if (existsSync(key) && existsSync(cert)) {
				dev.https = { key, cert, ca:cacert };
			} else {
				let gutter = ' '.repeat(4);
				let space = hasCA ? ' '.repeat(2) : '';
				let out = 'Certificate component(s) not found at locations provided!\n';
				out += colors.bold().white('--key ') + space + gutter + colors.italic().dim(key) + '\n';
				out += colors.bold().white('--cert') + space + gutter + colors.italic().dim(cert);
				if (hasCA) out += '\n' + colors.bold().white('--cacert') + gutter + colors.italic().dim(cacert);
				return log.error(out);
			}
		} else {
			dev.https = true;
			log.warn('Relying on self-signed certificate from `webpack-dev-server` internals');
		}
	}

	if (!opts.quiet) {
		let format = require('webpack-format-messages');
		let uri = require('url').format({ protocol, hostname, port });
		log.log(`Starting development server on ${ colors.white().bold().underline(uri) }`);

		function onError(arr) {
			arr = [].concat(arr || []);
github terkelg / prompts / lib / elements / confirm.js View on Github external
render() {
    if (this.closed) return;
    if (this.firstRender) this.out.write(cursor.hide);
    else this.out.write(clear(this.outputText));
    super.render();

    this.outputText = [
      style.symbol(this.done, this.aborted),
      color.bold(this.msg),
      style.delimiter(this.done),
      this.done ? (this.value ? this.yesMsg : this.noMsg)
          : color.gray(this.initialValue ? this.yesOption : this.noOption)
    ].join(' ');

    this.out.write(erase.line + cursor.to(0) + this.outputText);
  }
}