spcolor
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Spcolor

Codecov NPM License

Detect whether a terminal supports color. Can run on Node, Browser, Deno.

Usage

Node.js

npm install spcolor
import { getColorSupport } from "spcolor";

console.log(getColorSupport());

Deno

import { getColorSupport } from "npm:spcolor@latest";

console.log(getColorSupport());

API

getColorSupport()

  • Return: ColorSupport
interface ColorSupport {
  level: ColorSupportLevel;
  has24bit: boolean;
  has8bit: boolean;
  has4bit: boolean;
}

const enum ColorSupportLevel {
  /** 16m color support */
  bit24 = 3,
  /** 256 color support */
  bit8 = 2,
  /** 16 color support */
  bit4 = 1,
  /** no color support */
  none = 0,
}

Install

npm i spcolor

DownloadsWeekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

32.4 kB

Total Files

14

Last publish

Collaborators

  • idanran