Crates.io | text-style |
lib.rs | text-style |
version | 0.3.0 |
source | src |
created_at | 2020-09-24 18:55:47.264263 |
updated_at | 2021-06-18 07:21:02.115157 |
description | Types and conversions for styled text |
homepage | https://sr.ht/~ireas/text-style-rs |
repository | https://git.sr.ht/~ireas/text-style-rs |
max_upload_size | |
id | 292611 |
size | 122,045 |
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.
This crate has the following features:
ansi_term
: convert to ansi_term
typescrossterm
: convert to crossterm
typescursive
: convert to cursive
typessyntect
: convert from syntect
typestermion
: convert to termion
typesAll features are disabled per default.
This crate supports Rust 1.45.0 or later.
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.
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.
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.