1.0.4 • Published 3 years ago
spcolor v1.0.4
Spcolor
Detect whether a terminal supports color. Can run on Node, Browser, Deno.
Usage
Node.js
npm install spcolorimport { 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,
}