| Crates.io | ransi |
| lib.rs | ransi |
| version | 1.1.0 |
| created_at | 2025-04-25 15:38:17.351272+00 |
| updated_at | 2025-04-26 06:53:24.916993+00 |
| description | ransi - Utility for ANSI escape codes |
| homepage | https://github.com/dev-nebulae/ransi |
| repository | https://github.com/dev-nebulae/ransi |
| max_upload_size | |
| id | 1649141 |
| size | 58,546 |
ransi is a simple Rust library to help you make TUIs without going through
the pain of ANSI escape codes.
ransi provides a simple and easy-to-use API that allows you
to format, color, and style text on the terminal.
Run this command to install the latest version of ransi:
cargo add ransi
Or add it to your Cargo.toml file:
[dependencies]
ransi = "0.1"
| Function | Description |
|---|---|
change_fg(color: &str or (r: u8, g: u8, b: u8)) |
Change the foreground color |
change_bg(color: &str or (r: u8, g: u8, b: u8)) |
Change the background color |
bold(string: &str) |
Make the string be bold if printed |
italic(string: &str) |
Make the string be italic if printed |
blink(string: &str) |
Make the string blink if printed |
mov_cur(x: u16, y: u16) |
Move the cursor to a position |
| ` |
ransi::ColorIn - Color Input. Used by the change_col function to support
or a tuple of three u8s or the color name.This isn't completely true, as it misses the 21m escape code, which almost always leads to undefined behavior in different terminals.
Originally, 21m was used to dim text, but no terminal supports it, and the ones that do, double-underline the text and make it bright. Others keep the default behavour
It is pretty confusing, so we don't support it.