Ansis is a small and fast JavaScript library for adding ANSI colours and text styles to terminal output. It works in terminals, continuous integration environments and Chromium-based browsers.
The library supports chainable styles and tagged template literals, including nested templates. It automatically detects colour support and falls back gracefully when true colour or 256-colour output is unavailable.
This is free and open source software.
Key Features
- Supports standard 16-colour ANSI output, 256 colours and true colour.
- Specifies foreground and background colours using hexadecimal or RGB values.
- Provides bold, dim, italic, underline, strikethrough, inverse, hidden and other text styles.
- Combines colours and styles using a chainable syntax.
- Supports tagged template literals and deeply nested templates.
- Automatically detects the available colour level.
- Falls back from true colour to 256 colours, 16 colours or uncoloured output.
- Honours the NO_COLOR, FORCE_COLOR and COLORTERM environment variables.
- Recognises command-line flags for enabling or disabling colour output.
- Provides functions for stripping ANSI escape sequences and creating terminal hyperlinks.
- Supports ESM, CommonJS and TypeScript.
- Works with Node.js, Bun, Deno, CI services and Chromium-based browsers.
- Can act as a drop-in replacement for Chalk and several other terminal styling libraries.
Website: github.com/webdiscus/ansis
Support:
Developer: webdiscus
License: ISC License

Ansis is written in JavaScript. Learn JavaScript with our recommended free books and free tutorials.
Related Software
| Terminal String Styling Tools | |
|---|---|
| Rich | Python library for rich text and beautiful formatting |
| Chalk | Bills itself as “Terminal string styling done right” |
| picocolors | Tiny and fast library for terminal output formatting |
| yoctocolors | Small and fast command-line coloring package |
| yachalk | Clone of Chalk written in Python |
| kleur | Node.js library for formatting terminal text with ANSI colors |
| colorette | Set your terminal text color and styles |
| sty | String styling for your terminal |
| termcolor | ANSI color formatting for output in the terminal |
| colored | Simple Python library for color and formatting in terminal |
| ansicolors | ANSI colors for Python |
| ansi-colors | Add ANSI colors to terminal text |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |


Please read our Comment Policy before commenting.