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

Warning for inverted QR codes (when background color is dark and foreground light) #20

Open
rugk opened this issue Apr 16, 2018 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Hacktoberfest 2020, https://hacktoberfest.digitalocean.com

Comments

@rugk
Copy link
Owner

rugk commented Apr 16, 2018

Similar to #19 there should be warning. But this time, it should just say that you can only scan such inverted Qr codes with some QR code readers (e.g. Android "Barcode reader" with a special option).

Maybe also create a wiki page (or FAQ?), for such a thing and explain how to scan it.

Depends on #19

@rugk rugk added enhancement New feature or request good first issue Good for newcomers labels Apr 16, 2018
@LMLB
Copy link

LMLB commented May 20, 2018

I have separated the luminance calculation into it's own function in the gist I posted in the other issue.

@rugk
Copy link
Owner Author

rugk commented May 20, 2018

Great, but did you see that @ENT8R already created an own PR, which includes the contrast (and thus, as it seems luminance) calculation: https://github.com/rugk/offline-qr-code/pull/86/files#diff-91ba5f4df12e1b6b0629662164b3f14eR245?
(Although I'd think for code style reasons, your version really looks better, so @ENT8R you use that. Of course, you can also give @LMLB push access to that branch.)

But as for this issue (i.e. "finding out which color is dark/light") I don't think we need a new function for that luminance thing. Could not the contrast ratio calculation just return -3 or +3 (or speaking in general terms -x/+x) depending on in which order the colors are compared?
But if it is cleaner or easier with that additional functions, so be it. 😄

@LMLB
Copy link

LMLB commented May 21, 2018

You could replace Math.max(l1, l2) with l1 and Math.min(l1, l2) with l2, then it returns a number less than 1 for inverted colors (assuming rgb1 is foreground and rgb2 is background).

@rugk
Copy link
Owner Author

rugk commented May 21, 2018

Sounds good…

@rugk
Copy link
Owner Author

rugk commented Aug 5, 2018

BTW, @LMLB, – I know, I am a bit late –, but if you wanna do a PR, feel free to do so.

But I've got some other color issues in this repo, too. 😄

@rugk rugk added the hacktoberfest Hacktoberfest 2020, https://hacktoberfest.digitalocean.com label Oct 14, 2018
@rugk rugk removed the hacktoberfest Hacktoberfest 2020, https://hacktoberfest.digitalocean.com label Oct 31, 2018
@rugk
Copy link
Owner Author

rugk commented Apr 24, 2019

I am assuming you will do no PR, @LMLB.

@rugk rugk pinned this issue Jun 3, 2019
@rugk rugk added the hacktoberfest Hacktoberfest 2020, https://hacktoberfest.digitalocean.com label Sep 25, 2019
@rugk rugk removed the hacktoberfest Hacktoberfest 2020, https://hacktoberfest.digitalocean.com label Nov 7, 2019
@rugk rugk added the hacktoberfest Hacktoberfest 2020, https://hacktoberfest.digitalocean.com label Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest Hacktoberfest 2020, https://hacktoberfest.digitalocean.com
Projects
None yet
Development

No branches or pull requests

2 participants