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 Libraries | |
|---|---|
| color | Go package for adding colour to terminal output |
| termenv | Advanced ANSI styling and terminal rendering for Go |
| owo_colors | Zero-allocation terminal colour library for Rust |
| Ansis | Small, fast library for styling terminal text |
| anstyle | Rust libraries for ANSI text styling |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.