claudiodangelis / qrcp

:zap: Transfer files over wifi from your computer to your mobile device by scanning a QR code without leaving the terminal.
https://qrcp.sh
MIT License
9.89k stars 524 forks source link

Option to invert QR code #287

Closed sbliven closed 7 months ago

sbliven commented 11 months ago

I'm opening this issue because:

The text-based QR codes currently have character FULL BLOCK (0xE29688) for white pixels and SPACE (0x20) for black pixels. This works for terminals with white text on black backgrounds or similar dark themes, but fails for light themes. I suggest adding an option to invert the characters for QR code generation.

Another option would be adding ANSI codes for black and white to the output, but this sounds error prone to me since terminals might redefine black and white text.

sbliven commented 11 months ago

Note that #150 recommends --browser as a work around. This works, but one of the main attractions of qrcp is that it works from the command line without interrupting my workflow like GUI tools.

claudiodangelis commented 11 months ago

Hello @sbliven , thanks for the suggestion! The QR code generation is delegated to the skip2/go-qrcode package, I will have a look and see if it's possible to invert colors.

Thanks, Claudio

sbliven commented 8 months ago

go-qrcode supports this. I've gone ahead and made a PR for this feature.