How to customize background color for some web pages opened with eww?

[Originally posted by]: http://emacs.stackexchange.com/questions/2955/how-to-customize-background-color-for-some-web-pages-opened-with-eww

I just installed emacs 24.4 and I’ve started using eww. But one annoying thing is that when I visit google.com I get a grey background which makes text really hard to read for my theme.

This is how it looks: enter image description here

Is there any way I could change the color of the background? I first thought I could customize eww faces but there is no option for this. I’m also curious why is this background color there, in the first place.

shareimprove this question

I’m not sure why the background color is there either, but it seems to be controlled by the function shr-color-check, which is supposed to check that the contrast between the fg and bg is sufficient for the text to be visible. I agree that the readability is not very good in your example. Luckily, there are some variables that can be tweaked: shr-color-visible-luminance-min and shr-color-visible-distance-min. I tried setting

(setq shr-color-visible-luminance-min 70)

and the results are much more readable:

Screenshot of eww window with better contrast

shareimprove this answer
Yep, using shr-color-visible-luminance-min makes the content of the page readable. Thanks. – caisah Nov 14 ’14 at 10:20
Advertisements