Giter VIP home page Giter VIP logo

Comments (6)

LMLB avatar LMLB commented on September 14, 2024

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

from offline-qr-code.

rugk avatar rugk commented on September 14, 2024

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. 😄

from offline-qr-code.

LMLB avatar LMLB commented on September 14, 2024

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).

from offline-qr-code.

rugk avatar rugk commented on September 14, 2024

Sounds good…

from offline-qr-code.

rugk avatar rugk commented on September 14, 2024

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. 😄

from offline-qr-code.

rugk avatar rugk commented on September 14, 2024

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

from offline-qr-code.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.