4 releases (2 breaking)

0.3.0 Jun 18, 2021
0.2.0 Oct 3, 2020
0.1.1 Sep 30, 2020
0.1.0 Sep 24, 2020

#776 in Data structures

Download history 97/week @ 2024-07-22 82/week @ 2024-07-29 77/week @ 2024-08-05 86/week @ 2024-08-12 73/week @ 2024-08-19 74/week @ 2024-08-26 48/week @ 2024-09-02 7/week @ 2024-09-09 25/week @ 2024-09-16 57/week @ 2024-09-23 115/week @ 2024-09-30 94/week @ 2024-10-07 25/week @ 2024-10-14 38/week @ 2024-10-21 71/week @ 2024-10-28 18/week @ 2024-11-04

161 downloads per month
Used in 2 crates

Apache-2.0 OR MIT

60KB
864 lines

text-style-rs

The text-style crate provides types and conversions for styled text.

Many crates produce or consume styled text. But converting between these crates requires lots of boilerplate code. This crate defines a subset of common types for styled text and conversion methods for multiple crates. This makes it easy to convert between the different formats and to prepare output that can be rendered by any of the supported crates.

let s = text_style::StyledStr::plain("test").bold();

let mut w = std::io::stdout();
text_style::ansi_term::render(&mut w, &s).expect("Rendering failed");
text_style::crossterm::render(&mut w, &s).expect("Rendering failed");
text_style::termion::render(&mut w, &s).expect("Rendering failed");

For more information, see the API documentation.

Features

This crate has the following features:

All features are disabled per default.

Minimum Supported Rust Version

This crate supports Rust 1.45.0 or later.

Contributing

Contributions to this project are welcome! Please submit patches to the mailing list ~ireas/public-inbox@lists.sr.ht (archive) using the [PATCH text-style-rs] subject prefix. For more information, see the Contributing Guide.

Contact

For bug reports, feature requests and other messages, please send a mail to ~ireas/public-inbox@lists.sr.ht (archive) using the [text-style-rs] prefix in the subject.

License

This project is dual-licensed under the Apache-2.0 and MIT licenses. The documentation and examples contained in this repository are licensed under the Creative Commons Zero license. You can find a copy of the license texts in the LICENSES directory.

merge-rs complies with version 3.0 of the REUSE specification.

Dependencies

~0–12MB
~95K SLoC