How to use the ansi-colors.gray function in ansi-colors

To help you get started, we’ve selected a few ansi-colors 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 ivogabe / gulp-typescript / lib / reporter.ts View on Github external
error: (error: TypeScriptError, typescript: typeof ts) => {
			console.log('[' + colors.gray('gulp-typescript') + '] '
				+ colors.bgRed(error.diagnostic.code + '')
				+ ' ' + colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'))
			);

			if (error.tsFile) {
				console.log('> ' + colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + colors.gray(':'));
				const lines = error.tsFile.text.split(/(?:\r\n|\r|\n)/);

				const logLine = (lineIndex: number, errorStart: number, errorEnd?: number) => {
					const line = lines[lineIndex];
					if (errorEnd === undefined) errorEnd = line.length;
					console.log('> ' + colors.gray('[' + (lineIndex + 1) + '] ')
						+ line.substring(0, errorStart)
						+ colors.red(line.substring(errorStart, errorEnd))
						+ line.substring(errorEnd)
					);
				}

				for (let i = error.startPosition.line; i <= error.endPosition.line; i++) {
					logLine(i,
						i === error.startPosition.line ? error.startPosition.character : 0,
						i === error.endPosition.line ? error.endPosition.character : undefined
github pgilad / gulp-todo / index.js View on Github external
comments.forEach(function(comment) {
        const isTodo = /todo/i.test(comment.tag);
        const commentType = isTodo ? colors.cyan(comment.tag) : colors.magenta(comment.tag);
        const commentLocation = '@' + colors.gray(comment.file + ':' + comment.line);
        fancyLog(commentType, comment.text, commentLocation);
    });
}
github NewFuture / miniprogram-build / src / log / compile.js View on Github external
function outputStyle(str) {
    if (str) {
        return chalk.gray(" → ") + chalk.underline.bold.gray(str);
    }
    return '';
}
github exodus4d / pathfinder / gulpfile.js View on Github external
${colors.gray('default')}           Development environment. Working with row src files and file watcher, default:
            ${colors.gray('')}                      ${colors.gray('--jsUglify=false --jsSourcemaps=false --cssSourcemaps=false --jsGzip=false --cssGzip=false --jsBrotli=false --cssBrotli=false')}
            ${colors.gray('production')}        Production build. Concat and uglify static resources, default:
            ${colors.gray('')}                      ${colors.gray('--jsUglify=true --jsSourcemaps=true --cssSourcemaps=true --jsGzip=true --cssGzip=true --jsBrotli=true --cssBrotli=true')}
         
        ${colors.cyan('options:')}
            ${colors.gray('--tag')}             Set build version.                  ${colors.gray('default: --tag="v1.2.4" -> dest path: public/js/v1.2.4')}
            ${colors.gray('--jsUglify')}        Set js uglification.                ${colors.gray('(true || false)')}
            ${colors.gray('--jsSourcemaps')}    Set js sourcemaps generation.       ${colors.gray('(true || false)')}
            ${colors.gray('--jsGzip')}          Set js "gzip" compression mode.     ${colors.gray('(true || false)')}
            ${colors.gray('--jsBrotli')}        Set js "brotli" compression mode.   ${colors.gray('(true || false)')}
             
            ${colors.gray('--cssSourcemaps')}   Set CSS sourcemaps generation.      ${colors.gray('(true || false)')}
            ${colors.gray('--cssGzip')}         Set CSS "gzip" compression mode.    ${colors.gray('(true || false)')}
            ${colors.gray('--cssBrotli')}       Set CSS "brotli" compression mode.  ${colors.gray('(true || false)')}
            ${colors.gray('--debug')}           Set debug mode (more output).       ${colors.gray('(true || false)')}
    `);
    log(colors.cyan('='.repeat(cliBoxLength)));
    log('');
};
github jonschlinkert / log-utils / index.js View on Github external
getter(log, 'timestamp', () => {
  return '[' + colors.gray(timestamp('HH:mm:ss')) + ']';
});
github exodus4d / pathfinder / gulpfile.js View on Github external
let printHelp = () => {
    let cliLineLength = (cliBoxLength - 7);
    log('');
    log(colors.cyan( '= HELP ' + '='.repeat(cliLineLength)));
    log(`
        ${colors.cyan('documentation:')}        ${colors.gray('https://github.com/exodus4d/pathfinder/wiki/GulpJs')}
         
        ${colors.cyan('usage:')}                ${colors.gray('$ npm run gulp [task] -- [--options] ...')}
         
        ${colors.cyan('tasks:')}
            ${colors.gray('help')}              This view
            ${colors.gray('default')}           Development environment. Working with row src files and file watcher, default:
            ${colors.gray('')}                      ${colors.gray('--jsUglify=false --jsSourcemaps=false --cssSourcemaps=false --jsGzip=false --cssGzip=false --jsBrotli=false --cssBrotli=false')}
            ${colors.gray('production')}        Production build. Concat and uglify static resources, default:
            ${colors.gray('')}                      ${colors.gray('--jsUglify=true --jsSourcemaps=true --cssSourcemaps=true --jsGzip=true --cssGzip=true --jsBrotli=true --cssBrotli=true')}
         
        ${colors.cyan('options:')}
            ${colors.gray('--tag')}             Set build version.                  ${colors.gray('default: --tag="v1.2.4" -> dest path: public/js/v1.2.4')}
            ${colors.gray('--jsUglify')}        Set js uglification.                ${colors.gray('(true || false)')}
            ${colors.gray('--jsSourcemaps')}    Set js sourcemaps generation.       ${colors.gray('(true || false)')}
            ${colors.gray('--jsGzip')}          Set js "gzip" compression mode.     ${colors.gray('(true || false)')}
            ${colors.gray('--jsBrotli')}        Set js "brotli" compression mode.   ${colors.gray('(true || false)')}
github exodus4d / pathfinder / gulpfile.js View on Github external
let printError = (title, example) => {
    let cliLineLength = (cliBoxLength - 8);

    log('');
    log(colors.red( '= ERROR ' + '=' . repeat(cliLineLength)));
    log(colors.red(title));
    if(example){
        log(`
             ${colors.gray(example)}
        `);
    }
    log(colors.red('='.repeat(cliBoxLength)));
    log('');
};
github NewFuture / miniprogram-build / src / log / size.js View on Github external
function log(sym, what, size, duration, highlightSize) {
        let title = opts.title;
        title = title ? titleColor(title) : '';
        if (opts.sub) {
            sym += chalk.cyanBright(` <${chalk.bold.underline(opts.sub)}>`);
        }
        size = opts.pretty ? prettyBytes(size) : (size + ' B');
        duration = duration ? chalk.gray("[" + prettyTime(duration) + "]") : '';
        fancyLog(title , sym , what, chalk.gray('(') + chalk[highlightSize ? 'magentaBright' : 'gray'](size) + chalk.gray(')') + duration);
    }
github enquirer / enquirer / prompts / autocomplete.js View on Github external
render() {
    this.pointer = () => '';
    this.hint = this.typed || colors.gray(this.selected && this.selected.value || '');
    super.render();
  }

ansi-colors

Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis