anstyle is a collection of Rust libraries for defining, parsing, converting and applying ANSI terminal styles. Its core crate provides common styling types that allow libraries to exchange colour and formatting information without exposing a particular terminal-styling implementation through their public APIs.
The project prioritises API stability, minimal compile-time and binary-size overhead, and const-friendly interfaces for statically defined styles. The core library can also operate without Rust’s standard library.
This is free and open source software.
Key Features
- Defines interoperable types for ANSI colours, effects, styles and reset sequences.
- Supports standard, 256-colour and RGB terminal colours.
- Provides a const-friendly API for defining styles at compile time.
- Offers optional
no_stdoperation. - Includes parsers for Git-style colour descriptions and
LS_COLORSconfigurations. - Parses ANSI style escape sequences.
- Converts styled terminal output to SVG and roff formats.
- Integrates with ansi_term, crossterm, owo-colors, syntect, termcolor and yansi.
- Provides cross-platform coloured output through the companion anstream crate.
- Supports styling on legacy Microsoft Windows consoles.
- Allows conversion between different colour representations.
Website: rust-cli/anstyle
Support:
Developer: rust-cli team
License: MIT License or Apache License 2.0
anstyle is written in Rust. Learn Rust 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.