How to use the color-support.level function in color-support

To help you get started, we’ve selected a few color-support 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 jeroenouw / liftr-tscov / src / tscov / tscov.ts View on Github external
import 'reflect-metadata'
import minimist from 'minimist'
import * as path from 'path'
import * as packageJson from '../../package.json'
import { red, green, cyan, white, default as kleur } from 'kleur'

import { inject, injectable } from 'inversify'
import { CheckTypes } from './check-types'
import { Options } from './options'
import { MinCoverage } from './min-coverage'

const figlet = require('figlet')

kleur.enabled = require('color-support').level

@injectable()
export class Tscov {
  public suppressError: boolean = false

  constructor(
    @inject('Options') private options: Options,
    @inject('CheckTypes') private checkTypes: CheckTypes,
    @inject('MinCoverage') private minCoverage: MinCoverage
  ) {
    try {
      this.executeTscov()
        .then(success => {
          this.showSpacesLog()
          if (!success && !this.suppressError) {
            process.exit(1)
github mehmet-erim / symlink-manager / src / utils / log.js View on Github external
import ora from 'ora';
import kleur from 'kleur';
kleur.enabled = require('color-support').level;

export class Log {
  static log(text, color) {
    console.log(kleur[color]().bold(text));
  }

  static info(text) {
    this.log(text, 'cyan');
  }

  static primary(text) {
    this.log(text, 'blue');
  }

  static success(text) {
    this.log(text, 'green');

color-support

A module which will endeavor to guess your terminal's level of color support.

ISC
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular color-support functions