Is Ansi Color SupportedIntroduction

Introduction

Detect terminal color support for ANSI, 256 colors, and TrueColor.

Last updated:

@visulima/is-ansi-color-supported

Detect terminal color support capabilities including ANSI 16 colors, 256 colors, and TrueColor (16 million colors).

Quick Start

import { isAnsiColorSupported } from "@visulima/is-ansi-color-supported";

const colorLevel = isAnsiColorSupported();

if (colorLevel >= 3) {
    console.log("TrueColor supported!");
} else if (colorLevel >= 2) {
    console.log("256 colors supported");
} else if (colorLevel >= 1) {
    console.log("Basic ANSI colors supported");
} else {
    console.log("No color support");
}

Color Levels

  • 0 - No color support
  • 1 - Basic 16 colors (ANSI)
  • 2 - 256 colors
  • 3 - TrueColor (16 million colors)
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues