Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected colors when combining UTF-8 string with ANSI escape sequences #67

Open
sorairolake opened this issue Jul 12, 2024 · 0 comments

Comments

@sorairolake
Copy link
Contributor

sorairolake commented Jul 12, 2024

When you combine UTF-8 string with ANSI escape sequences, the bottom color becomes darker. This should be of light color just like the one before it.

use qrcode::{render::unicode::Dense1x2, QrCode};
use yansi::Paint;

fn main() {
    let code = QrCode::new("mow mow").unwrap();
    let image = code
        .render::<Dense1x2>()
        .dark_color(Dense1x2::Light)
        .light_color(Dense1x2::Dark)
        .build()
        .lines()
        .map(|l| format!("{}", l.green().on_bright_black()))
        .collect::<Vec<_>>()
        .join("\n");
    println!("{}", image);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant