News for hackers. Stuff that matters.
Re:Show HN: Grayscale the Web – A Chrome extension to help a... by daft300punk on Tuesday May 22, 2018 @11:59AM (#17126899)
Seems very useful, thanks. Curious how it affects cpu usage. Would be cool if you can explain how it works. I can see even the gifs and videos(which I think makes this even more useful) are rendered black & white.
Re:Show HN: Grayscale the Web – A Chrome extension to help a... by petecox on Tuesday May 22, 2018 @02:39PM (#17128334)
Potentially there's power savings on a mobile device by restricting the color palette to grayscale? If so this could be incorporated into one's phone's battery saver mode.
Re:Show HN: Grayscale the Web – A Chrome extension to help a... by sakuronto on Tuesday May 22, 2018 @12:07PM (#17126965)
My guess is that it just applies a CSS filter on the entire page.
Re:Show HN: Grayscale the Web – A Chrome extension to help a... by devastora on Tuesday May 22, 2018 @12:29PM (#17127174)
Yep, you got it. For the most part I'm just adding filter: grayscale(100%) to the html element.

There some other stuff going on though. I noticed that for the html and body elements, if they had a background image/color, the grayscale trick wouldn't work for them.

So, on the options page I added a toggle to "Remove All Background Colors and Images No Matter What". This goes through the page and checks if there is a background image or color, then uses this library (https://github.com/bgrins/TinyColor) to check the perceived lightness of the color and changes the background to use a shade of gray instead.

Performance wise, I don't have any specific numbers, but I did a lot of dogfooding on my own before releasing and didn't notice any perceivable slowdown.