npm

Need private packages and team management tools?Check out npm Orgs. »

@fav/cli.get-color-depth

0.1.1 • Public • Published

@fav/cli.get-color-depth NPM MIT License Build Status Coverage status

Determine what colors the terminal supports.

This module is created referencing tty.WriteStream#getColorDepth of Node.js API.

"fav" is an abbreviation of "favorite" and also the acronym of "for all versions". This package is intended to support all Node.js versions as possible. At least, this package supports Node.js >= v0.10.

Install

To install from npm:

$ npm install --save @fav/cli.get-color-depth

NOTE: npm < 2.7.0 does not support scoped package, but old version Node.js supports it. So when you use such older npm, you should download this package from github.com, and move it in node_modules/@fav/cli.get-color-depth/ directory manually.

Usage

var getColorDepth = require('@fav/cli.get-color-depth');
getColorDepth() // => 1 or 4 or 8 or 24

API

getColorDepth([env]) : number

Detects color depth supported by this terminal or the environment indicated by env.

Parameters:

Parameter Type Description
env object An object containing the environment variables to check. Uses process.env if not specified. (Optional)

Returns:

Type Description
number Color depth. (1:2 colors / 4:16 colors / 8:256 colors / 24: 16m colors)

Checked

Node.js (4〜12)

Platform 11 12
macOS
Windows10
Linux
Platform 4 5 6 7 8 9 10
macOS
Windows10
Linux

io.js (1〜3)

Platform 1 2 3
macOS
Windows10
Linux

Node.js (〜0.12)

Platform 0.8 0.9 0.10 0.11 0.12
macOS
Windows10
Linux

License

Copyright (C) 2019 Takayuki Sato

This program is free software under MIT License. See the file LICENSE in this distribution for more details.

install

npm i @fav/cli.get-color-depth

Downloadsweekly downloads

1

version

0.1.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability