supports-color

  • Version 9.4.0
  • Published
  • 10.8 kB
  • No dependencies
  • MIT license

Install

npm i supports-color
yarn add supports-color
pnpm add supports-color

Overview

Detect whether a terminal supports color

Index

Variables

variable supportsColor

const supportsColor: { stdout: ColorInfo; stderr: ColorInfo };

    Functions

    function createSupportsColor

    createSupportsColor: (stream?: WriteStream, options?: Options) => ColorInfo;

      Interfaces

      interface ColorSupport

      interface ColorSupport {}
      • Detect whether the terminal supports color.

      property has16m

      has16m: boolean;
      • Whether Truecolor 16 million colors are supported.

      property has256

      has256: boolean;
      • Whether ANSI 256 colors are supported.

      property hasBasic

      hasBasic: boolean;
      • Whether basic 16 colors are supported.

      property level

      level: ColorSupportLevel;
      • The color level.

      interface Options

      interface Options {}

        property sniffFlags

        readonly sniffFlags?: boolean;
        • Whether process.argv should be sniffed for --color and --no-color flags.

          true

        Type Aliases

        type ColorInfo

        type ColorInfo = ColorSupport | false;

          type ColorSupportLevel

          type ColorSupportLevel = 0 | 1 | 2 | 3;
          • Levels: - 0 - All colors disabled. - 1 - Basic 16 colors support. - 2 - ANSI 256 colors support. - 3 - Truecolor 16 million colors support.

          Package Files (1)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (5)

          Peer Dependencies (0)

          No peer dependencies.

          Badge

          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/supports-color.

          • Markdown
            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/supports-color)
          • HTML
            <a href="https://www.jsdocs.io/package/supports-color"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>