-
Notifications
You must be signed in to change notification settings - Fork 12
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
Invert dark favicons (#114) #222
Conversation
Oops, I didn't notice that CI is failed. I'll fix it later. |
Thank you so much for working on this! I have merged this via e901efc in the 0.13.0 branch and gave it a bit of fine tuning via dda4587 and 7f8d4d3 It is live now in the dev version. I want to use it for a few days in "real world browsing" before I merge it into master, but looks pretty good 👍 |
Thanks for merging and refinement! Could you close this PR after you merge it into master? |
Yes, I will do this. My first impression is, that it will need some further work. Likely some calculation of the contrast between the average icon color and the tab color to determinate if it should get inverted. Right now the Netflix logo is getting inverted even though it is (in my opinion) very noticeable and doesn't need to get inverted. Same with the YouTube icon, which would also get inverted when I wouldn't have changed the brightness threshold. I guess red icons in general are likely counted as dark, even when they would be easily see-able in the dark themes. Also I guess I will make the inversion optional feature of some sort |
I've pushed other commits to following branch. 763b3a1Skips inversion when some errors occur. b03cd49Gives 'mode' param to FastAverageColor. 'precision' should give us precise result, I think. 4b82758Uses rgb values to detect dark color instead of 'color.isDark'. I refer this StackOverflow. function setText(text, averageColor, id){
if(averageColor[0] <= 80 && averageColor[1] <= 80 && averageColor[2] <= 80){
document.getElementById(id).innerHTML = "<font color='#ffffff'>"+text+"</font>";
}
else if(averageColor[0] >= 150 && averageColor[1] >= 150 && averageColor[2] >= 150){
document.getElementById(id).innerHTML = "<font color='#000000'>"+text+"</font>";
}
} I put threshold value back to 128 because 'color.isDark' is no longer used. e9c3b1aFixes list errors. ....I always fotget about lint 😓 What do you think these changes? |
It works good for me. I will recreate another pull request. So I will close this. |
I've fixed #114 . I added an external library in order to detect dark favicon.
https://github.com/fast-average-color/fast-average-color