Skip to content

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

@sorairolake

Description

@sorairolake

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions