-
Notifications
You must be signed in to change notification settings - Fork 40
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
Perceived Brightness #27
Comments
I once had plans to implement contrast text color, but never came up with an api I liked. This would be a more low level version of it I guess. Feels like adding a Would you like to take a swing at it yourself? It's pretty easy to write plugins: https://github.com/One-com/one-color/blob/master/lib/color/plugins/greyscale.js Looks like I don't see a specification of what the output range is, nor any dataset to implement unit tests from though :( |
Thanks for the quick answer :) I currently do some experiments with one-color and calculations of perceived brightness based on the link I posted above. But I'll do some more research. There is no real standard and you find several algos to calculate perceived brightness. |
Now I'm ready to show a first test. I use one-color with the alpha version of my jquery plugin jsPanel. You can find a live preview at It includes a one-color plugin to calculate perceived brightness which I uploaded to my forked repo of one-color. If you don't mind I'd ask you to check it before I make a pull request: Thanks, Stefan |
If the HSP percieved brightness formula is |
Well, you're probably right, but I tested both versions and the differences were marginal. However, I changed this algorithm and added 2 more. So there're 4 algos now to test:
After searching the web for this topic I think I can safely say that there is now single ultimately correct algorithm to calculate perceived brightness. As the term perceived brightness already implies it's a very individual perception since there're no two human brains seeing a color in exactly the same way. So any algorithm can only be a more or less imperfect help. But I think those 4 algos offer a reasonable way to start in combination with a threshold depending on the use case. https://github.com/Flyer53/one-color/blob/master/lib/color/plugins/perceived-brightness.js |
Hi there and thanks for this great tool :)
Did you ever consider adding a method that calculates perceived brightness of a given color? I think this would be a real improvement.
A good post about this is found here
http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
Regards, Stefan
The text was updated successfully, but these errors were encountered: