1.0.1 • Published 7 years ago

supports-semigraphics v1.0.1

Weekly downloads
453
License
MIT
Repository
github
Last release
7 years ago

supports-semigraphics NPM Version Build Status Dependency Monitor

Determine if your terminal supports text animations.

Some environments try to simulate a TTY which can bugger up logs with your progress bar, character spinner, etc semigraphic animations.

Installation

Node.js >= 4 is required. To install, type this at the command line:

npm install supports-semigraphics

Usage

const supportsSemigraphics = require('supports-semigraphics');

if (supportsSemigraphics()) {
	// the terminal probably has support for semigraphics
}

You can also check a specific stream:

supportsSemigraphics(fs.createWriteStream('./output.log'));
//-> false

Info

It obeys the --animation and --no-animation CLI flags.

For situations where using --animation is not possible, add an environment variable FORCE_ANIMATION with any value to force animations. Trumps --no-animation.