Giter VIP home page Giter VIP logo

Comments (9)

rugk avatar rugk commented on August 10, 2024 1

Okay, but the main source code for that "colorable" looks quite nice and is not too much – problem is it depends on some stuff there.

Mhh, can't we have an easier version?

I mean, if it works well… the Stackexchange answer might be sufficient and easy enough to maintain – just some mathematical stuff. 😆

from offline-qr-code.

LMLB avatar LMLB commented on August 10, 2024 1

The underscore in that code is just a local variable and has nothing to do with underscore.js. Your other point is fair and I made a simple (~10 LOC) function based on that code: https://gist.github.com/LMLB/47cb7997f9e7e4cf1f1052f80f93b195

from offline-qr-code.

ENT8R avatar ENT8R commented on August 10, 2024

Does https://stackoverflow.com/a/9733420/8575129 fit your needs?

from offline-qr-code.

rugk avatar rugk commented on August 10, 2024

On the first look, lookd good. The linked repo is rather not so good as it depends on jQuery and is not really packed as a module…

BTW as for searching for stuff: Maybe you could also look for the accessibility contrast checkers (you know, these who tell you it's AAA, AA or A, …). Maybe they also some clever up-to-date algos or libraries.

from offline-qr-code.

ENT8R avatar ENT8R commented on August 10, 2024

Maybe this is a suitable accessibility contrast checker: https://github.com/jxnblk/colorable (but the last commit was about 3 years ago 😏) There is even a list of a whole bunch of tools, but it does not really contain what we want IMO: https://github.com/prettydiff/a11y-tools

from offline-qr-code.

LMLB avatar LMLB commented on August 10, 2024

When it comes to LeaVerou/contrast-ratio, the actual color contrast calculation code is in color.js (rather than contrast-ratio.js which seems to be about managing the user interface on the website).

from offline-qr-code.

rugk avatar rugk commented on August 10, 2024

Okay, well, still ~200 LOC for just a contrast calculation? And it also seems to include some "toString" code and other unrelated code. (And is intended for use by underscore JS as it seems to extend ) All this is stuff we don't actually need. The only thing we need is a simple contrast calculation returning one value…

from offline-qr-code.

rugk avatar rugk commented on August 10, 2024

Oh, thanks!
BTW, did you actually saw this Stackoverflow answer linked before? Because the code looks similar at the first glance… (though your code is better documented 😉)

If you think the Stackoverflow code is better, then integrate it in your code, if needed.
If you think your code is better, then maybe post it on Stackoverflow (if you like, of course). Or maybe even create a tiny lib…

from offline-qr-code.

rugk avatar rugk commented on August 10, 2024

Done in #86

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.