Black or White Text? WCAG vs. Neural Networks
Posted: May 24, 2010 Filed under: mozilla | Tags: accessibility, neural networks 4 Comments »The other day I ran into a problem that some developers of color tools probably run into, which is: given a color, do you display white or black text over it? An algorithm based on the WCAG luminosity contrast ratio measure works great on most colors, but can be spotty. After looking at the WCAG formula, it seemed this problem was a good candidate for neural networks.
A couple weeks ago I finally sat down to try out the idea, and made a page where you can train your own neural network when to use black vs. white text (bonus: Worker thread example). After training it on a dozen or so colors, it matches the WCAG algorithm in most cases and does better in others. It’s kind of crazy that you can just throw data at this network and it will learn it. Not every problem can be solved by a neural network, but it’s cool to see it work when the problem fits. Might try out some other classifiers next.
I ended up making a simple JavaScript neural network implementation, you can check out the code on github.
Nice
Recently someone (in one of the blog feeding planet.mozilla.org) suggested to use neural networks to help with changing tabs (or tasks) using keyboard shortcuts (I think he called it the Alt-Tab-problem or so). In most cases people switch forth and back between certain programs and only occasionally need another program. When switching to this other program, it breaks the most-recent-order on the menu. You don’t feel like trying this as well?
maybe! Although, I think they were talking about Markov models, not sure that problem fits with neural networks in particular.
Now you mentioned the Markov model, I remember that it was this.
Searching brought up the link:
http://www.azarask.in/blog/post/solving-the-alt-tab-problem/
That’s the thing I was referring to. Thank you for pointing me at it again, I wasn’t able to find it before, so I couldn’t check before posting.
This is really neat! It’s impressive how something so simple(on the surface anyways) works so effectively.