Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shanecelis/text_style
https://github.com/shanecelis/text_style
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/shanecelis/text_style
- Owner: shanecelis
- Created: 2023-11-28T20:16:34.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-09T11:43:04.000Z (6 months ago)
- Last Synced: 2024-10-29T00:44:11.195Z (about 2 months ago)
- Language: Rust
- Size: 561 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSES/Apache-2.0.txt
Awesome Lists containing this project
README
# 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.```rust
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](https://docs.rs/text-style).
## Features
This crate has the following features:
- `ansi_term`: convert to [`ansi_term`](https://lib.rs/ansi_term) types
- `crossterm`: convert to [`crossterm`](https://lib.rs/crossterm) types
- `cursive`: convert to [`cursive`](https://lib.rs/cursive) types
- `syntect`: convert from [`syntect`](https://lib.rs/syntect) types
- `termion`: convert to [`termion`](https://lib.rs/termion) typesAll 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/[email protected]][] ([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/[email protected]][] ([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][CC0] 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][reuse].
[~ireas/[email protected]]: mailto:~ireas/[email protected]
[archive]: https://lists.sr.ht/~ireas/public-inbox
[Contributing Guide]: https://man.sr.ht/~ireas/guides/contributing.md
[Apache-2.0]: https://opensource.org/licenses/Apache-2.0
[MIT]: https://opensource.org/licenses/MIT
[CC0]: https://creativecommons.org/publicdomain/zero/1.0/
[reuse]: https://reuse.software/practices/3.0/