Comments (9)
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.
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.
Does https://stackoverflow.com/a/9733420/8575129 fit your needs?
from offline-qr-code.
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.
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.
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.
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.
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.
Done in #86
from offline-qr-code.
Related Issues (20)
- The "like addon" tip is too aggressive/too often shown HOT 9
- Extract information from a QR Code picture (.svg / .png / etc. ) HOT 2
- Save Page with Overlaid QR Code HOT 3
- Support define text template for generate similar QRs HOT 4
- Use system clipboard content than tab url to gen code. HOT 5
- Save QR SVG to copy-paste clipboard HOT 5
- Can we have a function to READ QR Codes as well HOT 2
- Updated translations for 'zh_TW': zh_TW HOT 1
- QR-code window does not open HOT 1
- Add shortcut icon to the address bar HOT 1
- Updated translations for 'uk': Ukrainian (Українська) HOT 1
- Configuration for hiding random tips HOT 1
- The undo button is too far from reset button HOT 10
- Automatically retrieve text from clipboard and generate QR - (pl) Automatycznie pobieraj tekst ze schowka i generuj QR HOT 3
- Encrypted exchange by QR-code channel HOT 5
- Spanish translation contribution HOT 8
- Updated translations for 'es': Spanish (Español) HOT 1
- Updated translations for 'zh_CN': zh_CN HOT 1
- Improve Contribution documentation HOT 1
- Add context-menu item for generating a QR code for _the current page_ HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from offline-qr-code.