| Crates.io | ratatui-canvas-polygon |
| lib.rs | ratatui-canvas-polygon |
| version | 0.1.1 |
| created_at | 2026-01-14 14:28:13.604339+00 |
| updated_at | 2026-01-22 14:48:56.002528+00 |
| description | A shape library for ratatui |
| homepage | |
| repository | https://github.com/JMANN240/ratatui-canvas-polygon |
| max_upload_size | |
| id | 2042910 |
| size | 32,751 |
A shape library for ratatui
Install with cargo:
cargo add ratatui-canvas-polygon
Use like any other shape:
let canvas = Canvas::default()
.x_bounds([0.0, 1.0])
.y_bounds([0.0, 1.0])
.paint(|context| {
context.draw(&Triangle::new(
[(0.25, 0.25), (0.25, 0.75), (0.5, 0.75)],
Color::White,
));
context.draw(&Triangle::new(
[(0.75, 0.25), (0.75, 0.75), (0.5, 0.75)],
Color::White,
));
});
Draws:
⢸⣿⣿⣿⣿⣿⣿⣿⠿⠟⠛⠋⠉⠉⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿
⠸⠿⠟⠛⠋⠉ ⠉⠉⠛⠻⠿