@crayon.js/color-support
v1.1.0
Published
Detect terminal color support
Downloads
2
Maintainers
Readme
🖍️ Crayon.js color support
:books: About
This package is extension for crayon.js however it can still be used by other packages.
Installation
npm install @crayon.js/color-support #yarn add @crayon.js/color-support
Syntax
interface CrayonColorSupport {
threeBitColor: boolean
fourBitColor: boolean
highColor: boolean
trueColor: boolean
}
Usage
import { getColorSupport, supportedColors, getWindowsVersion } from '@crayon.js/color-support';
const support = getColorSupport(); // detect terminal color support
const cached = supportedColors(); // cached getColorSupport (it just returns cached object)
const windowsVersion = getWindowsVersion(); // Reusable function [version (7/8/10...), versionId (14931...)], empty if detected system is not Windows
Usage with crayon.js
import crayon from 'crayon.js'; // it'll still work with packages that extend crayon instance as its config is global
import { getColorSupport } from '@crayon.js/color-support';
crayon.config.colorSupport = getColorSupport();