anstyle – collection of Rust libraries

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_std operation.
  • Includes parsers for Git-style colour descriptions and LS_COLORS configurations.
  • 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 Tools
RichPython library for rich text and beautiful formatting
ChalkBills itself as “Terminal string styling done right”
picocolorsTiny and fast library for terminal output formatting
yoctocolorsSmall and fast command-line coloring package
yachalkClone of Chalk written in Python
kleurNode.js library for formatting terminal text with ANSI colors
coloretteSet your terminal text color and styles
styString styling for your terminal
termcolorANSI color formatting for output in the terminal
coloredSimple Python library for color and formatting in terminal
ansicolorsANSI colors for Python
ansi-colorsAdd ANSI colors to terminal text

Read our verdict in the software roundup.


Best Free and Open Source Software 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.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted