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.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.