Canop / Canop/termimad

Support for `Colored`/terminal escape codes

Open
#72 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.2k
Forks
47
Avg merge
3d 16h
Merged PRs (30d)
1

Description

Thanks for the nifty package, it's very cool! I'd love to be able to use it with [Colored](https://github.com/colored-rs/colored), but using coloured text in a table breaks the layout:

```rust
use colored::Colorize;
use termimad::{MadSkin};

fn main() {
let header = "|:-|:-\n|**Example**|**Table**|\n|-|-";
let col1 = "Colourful text".bright_red();
let col2 = "breaks the table :(".bold();
let rest = format!("| {col1} | {col2} |");
let table = format!("{header}\n{rest}\n|-");

MadSkin::default().print_text(&table);
}
```

```console
$ cargo run
┌───────────────────────┬───────────────────────────┐
│Example │Table │
├───────────────────────┼───────────────────────────┤
│Colourful text│breaks the table :(│
└───────────────────────┴───────────────────────────┘
```

Image

My guess is it's counting escape codes when it shouldn't.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.