catppuccin-palette/rust/README.md

58 lines
1.1 KiB
Markdown
Raw Normal View History

2022-10-23 17:33:09 +02:00
# catppuccin
🦀 Soothing pastel theme for Rust.
## Usage
Add Catppuccin to your project's `Cargo.toml`:
```toml
[dependencies]
2022-10-24 00:36:20 +02:00
catppuccin = "1.0.4"
2022-10-23 17:33:09 +02:00
```
## Example
```rust
use catppuccin::MOCHA;
struct Button {
text: String,
background_colour: String,
};
fn confirm(text: String) -> Button {
Button {
text,
background_colour: MOCHA.green.hex(),
}
}
```
More examples can be found
[here](https://github.com/catppuccin/palette/tree/main/rust/examples).
Clone the repository to run them locally:
```bash
2022-10-23 17:33:09 +02:00
$ cargo run --example simple
```
![Output from simple example](https://raw.githubusercontent.com/catppuccin/palette/main/rust/assets/simple-example.png)
```bash
2022-10-23 17:33:09 +02:00
$ cargo run --features ansi --example term
```
![Output from term example](https://raw.githubusercontent.com/catppuccin/palette/main/rust/assets/term-example.png)
2022-10-23 17:33:09 +02:00
## Optional Features
### ANSI string painting
Enable the `ansi` feature to add the
[`Colour::ansi_paint`](crate::Colour::ansi_paint) method.
This adds [ansi-term](https://crates.io/crates/ansi_term) as a dependency.
License: MIT