1 | //! ANSI Text Styling |
2 | //! |
3 | //! *A portmanteau of "ansi style"* |
4 | //! |
5 | //! `anstyle` provides core types describing [ANSI styling escape |
6 | //! codes](https://en.wikipedia.org/wiki/ANSI_escape_code) for interoperability |
7 | //! between crates. |
8 | //! |
9 | //! Example use cases: |
10 | //! - An argument parser allowing callers to define the colors used in the help-output without |
11 | //! putting the text formatting crate in the public API |
12 | //! - A style description parser that can work with any text formatting crate |
13 | //! |
14 | //! Priorities: |
15 | //! 1. API stability |
16 | //! 2. Low compile-time and binary-size overhead |
17 | //! 3. `const` friendly API for callers to statically define their stylesheet |
18 | //! |
19 | //! For integration with text styling crate, see: |
20 | //! - [anstyle-ansi-term](https://docs.rs/anstyle-ansi-term) |
21 | //! - [anstyle-crossterm](https://docs.rs/anstyle-crossterm) |
22 | //! - [anstyle-owo-colors](https://docs.rs/anstyle-owo-colors) |
23 | //! - [anstyle-termcolor](https://docs.rs/anstyle-termcolor) |
24 | //! - [anstyle-yansi](https://docs.rs/anstyle-yansi) |
25 | //! |
26 | //! User-styling parsers: |
27 | //! - [anstyle-git](https://docs.rs/anstyle-git): Parse Git style descriptions |
28 | //! - [anstyle-ls](https://docs.rs/anstyle-ls): Parse `LS_COLORS` style descriptions |
29 | //! |
30 | //! Convert to other formats |
31 | //! - [anstream](https://docs.rs/anstream): A simple cross platform library for writing colored text to a terminal |
32 | //! - [anstyle-roff](https://docs.rs/anstyle-roff): For converting to ROFF |
33 | //! - [anstyle-syntect](https://docs.rs/anstyle-syntect): For working with syntax highlighting |
34 | //! |
35 | //! Utilities |
36 | //! - [anstyle-lossy](https://docs.rs/anstyle-lossy): Convert between `anstyle::Color` types |
37 | //! - [anstyle-parse](https://docs.rs/anstyle-parse): Parsing ANSI Style Escapes |
38 | //! - [anstyle-wincon](https://docs.rs/anstyle-wincon): Styling legacy Microsoft terminals |
39 | //! |
40 | //! # Examples |
41 | //! |
42 | //! The core type is [`Style`]: |
43 | //! ```rust |
44 | //! let style = anstyle::Style::new().bold(); |
45 | //! ``` |
46 | |
47 | #![cfg_attr (not(feature = "std" ), no_std)] |
48 | #![cfg_attr (docsrs, feature(doc_auto_cfg))] |
49 | #![warn (missing_docs)] |
50 | #![warn (clippy::print_stderr)] |
51 | #![warn (clippy::print_stdout)] |
52 | |
53 | #[macro_use ] |
54 | mod macros; |
55 | |
56 | mod color; |
57 | mod effect; |
58 | mod reset; |
59 | mod style; |
60 | |
61 | pub use color::*; |
62 | pub use effect::*; |
63 | pub use reset::*; |
64 | pub use style::*; |
65 | |