termenv is a Go library for safely adding colour and styling to terminal output. It detects the terminal’s capabilities and selects compatible ANSI colours and control sequences, avoiding the need to handle escape sequences and colour conversions directly.
The library supports applications running across terminals with different colour capabilities, automatically converting colours to the closest available alternative.
This is free and open source software.
Key Features
- Supports 16-colour ANSI, 256-colour and 24-bit TrueColor output.
- Automatically detects the terminal’s supported colour profile.
- Converts colours to the closest match supported by the terminal.
- Detects light and dark terminal themes.
- Provides a chainable syntax for combining colours and text styles.
- Supports bold, faint, italic, underline, overline, blinking, reverse and crossed-out text.
- Allows styles to be nested.
- Provides styling helpers for Go templates.
- Offers cursor positioning, screen management and scrolling controls.
- Supports alternate screens, bracketed paste and mouse tracking.
- Can set terminal colours, window titles and cursor visibility.
- Respects the NO_COLOR and CLICOLOR_FORCE environment variables.
Website: github.com/muesli/termenv
Support:
Developer: Christian Muehlhaeuser
License: MIT License

termenv is written in Go. Learn Go 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.