erwanvivien / fast_qr

Ultra fast QRCode generation
https://fast-qr.com/
MIT License
197 stars 29 forks source link

Support for terminals with light backgrounds #17

Closed ForgQi closed 1 year ago

ForgQi commented 1 year ago

Thank you for your work! I want to replace qrcode with your crate, Is it possible to implement like this for supports both dark and light colored terminals

    let code = QrCode::new("mow mow").unwrap();
    let image = code.render::<unicode::Dense1x2>()
        .dark_color(unicode::Dense1x2::Light)
        .light_color(unicode::Dense1x2::Dark)
        .build();
    println!("{}", image);
erwanvivien commented 1 year ago

Hey, there currently is no support for that, I will work on that tomorrow, thanks for the report !

erwanvivien commented 1 year ago

To add a bit more information to this issue, currently, the color is indeed set for dark and it is pretty bare-bone: https://github.com/erwanvivien/fast_qr/blob/master/src/helpers.rs#L31-L58

What customisation would you like to see ? Colors ? Module width ? Maybe it working on more terminals than Unix (would require an other crate) ?

ForgQi commented 1 year ago

in light backgrounds:

qrcode: image

fast_qr: image

Maybe needs to reverse the color

erwanvivien commented 1 year ago

That I understand, do you need anything more ?

ForgQi commented 1 year ago

Thank you for your response, it was great for me

erwanvivien commented 1 year ago

I removed the custom colors codes I had put, so it works by default, using the terminal default color