General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
how to force backgrund color
Posted by: arcull
Date: November 13, 2014 06:40PM

Hi there,

I wonder how can I force a background color in K-Meleon. In about:config I changed "browser.display.background_color" and "editor.use_custom_colors" but still no luck. Any help, much appreciated, thanks.

Options: ReplyQuote
Re: how to force backgrund color
Posted by: naruman
Date: November 13, 2014 07:26PM

Change "browser.display.use_document_colors" to false & change "browser.display.background_color" to the color you want .

Also you can use css to set the color like tis one.

Also Km+1 have an option to choose the colors under "about:preferences" in "chrome://browser/content/preferences/colors.xul" but it have some bug , i had forgotten to add it fix .

Options: ReplyQuote
Re: how to force background color
Posted by: siria
Date: November 13, 2014 07:46PM

I've struggled endlessly with that recently! But found no way other than a user style css, and it has a lot of drawbacks.
For specific sites specific solutions can be found, but a global style that works acceptable on ALL sites? No chance.

The main prob is, forcing a background-color will hide many images! Not just real -unimportant- "background" images, but also important ones which the authors only defined as background to make the downloading harder, or because it was easier to code or whatever.
On the other hand there are lots of websites where the user background color is covered by some plain graphic as background image.
The prob is, how to tell, if a background image shall better be removed or be kept???

The other main prob is: the font color must fit the background!
If you force a light background on ALL pages, then those pages which originally have a dark background and light text, will not be readable anymore!
Same if you force a dark background on ALL, then pages with black text will become unreadable!

There's no real way out, unless forcing both, text color and background colors.
But the forced text color has other drawbacks again, it's a real dilemma.
Anyway, if we're talking only about backgrounds, my best compromise was to force a background color and remove background-images on the 1-2 deepest layers, while forcing all layers above to a transparent background color but leaving their images.

But I'm no expert at all with css, perhaps you or anyone finds a better solution?

There are various macros and extensions out there to play with css userstyles, but am not familiar with most, only my own ones and the tiny styles.kmm from kmext.sf.net. None is perfect yet, but luckily there's always the native K-Meleon ways:
add your style into your userContent.css (needs restart for changes?) or into adblock.css (can be toggled on/off during session, that reloads changed code)
They are in your profile folder (Edit > Configuration > Profile directory > chrome)

If you like you can start your own attempts with my latest private version.
Exchange the color with your own one. The example is light greenish.

html, body { background-color: #99bb77 !important; }
body *, div, table, td, tr, th, img { background-color: transparent !important; }

/* Compromise: hides 2-level background images only. Helps on addons.mozilla.org, leaves the starlets visible */
body, body > * { background-image: none !important; }


Edit:
Ah yes, had forgotten now about that native color-setting smiling smiley
But at the time I did those tests had tried that too, but for some reason wasn't happy with it. If I remember right, it was too extreme and hiding too much, but am not sure anymore.



Edited 2 time(s). Last edit at 11/13/2014 07:55PM by siria.

Options: ReplyQuote
Re: how to force backgrund color
Posted by: arcull
Date: November 13, 2014 08:44PM

Thanks it works smiling smiley

Options: ReplyQuote
Re: how to force backgrund color
Posted by: arcull
Date: November 13, 2014 08:52PM

siria, I see you did a whole study on this. You are right, there is no general simple solution which would work well on all sites. Well my purpose of changing color is just to get a bit darker background since the white color is just too much shiny for a few hours of browsing. I'll give it try with just setting color in about:cfg for now, to see how it works out. But as you said, you may miss some pictures on other elements on pages. Thank you very much for your contribution on this matter.

Options: ReplyQuote
Re: how to force backgrund color
Posted by: JohnHell
Date: November 13, 2014 11:06PM

Just to clear it.

With the prefs you aren't missing anything. It just change the body background to your color.

And that won't work ever as the body now is just the wall where to paint a website too. Lots of sites place a div element for the full height and div covering the whole boddy and the color you set won't do much.

usercontent.css is the only way and, as Siria has said, it can't be applied to every site the same rules.



Edited 1 time(s). Last edit at 11/13/2014 11:08PM by JohnHell.

Options: ReplyQuote
Re: how to force backgrund color
Posted by: siria
Date: November 14, 2014 12:05AM

addons.mozilla.org is a nice test page.

When only setting "browser.display.background_color" that has zero effect. Page remains white.

When also blocking "browser.display.use_document_colors" the colors change, but the starlet-icons vanish too. Not quite sure why, but probably are covered by a forced background-color on all elements.

With my css-snippet above only the body background gets a forced color, and higher levels get a forced transparent color. That keeps the starlets visible.

Still, one of the drawbacks of forced colors for text also (must contrast the background) is that author colors on text vanish. As example in my previous post there are some blue lines for code. With forced colors those lines get the same color as the rest of the text sad smiley

Another trick is often use is to kill all css-FILES. Messes the layout completely, but in rare cases it can do some nice tricks, for example the blue code lines above look blue again. And yet it shows the default background color set by the first user pref. (What I love most about killing css is that often hidden page content suddenly shows up, that would otherwise need javascript allowed to flip open tongue sticking out smiley)

Oh well. Too bad I had to give up on my various styles macros. A major reason is that it all got too complex and complicated of course (as usual), but a real killer is also that infamous rebarmenu bug. Just need to get correct checkmarks shown in my overloaded styles menu. For my personal use I know about it and know that only a right-click will show the correct checkmarks, so am living with my beta macros, but for most other users that will be too 'complicated' to understand sad smiley
Another pain is the line-order-bug, as I call it, that later macro lines get executed before earlier ones (have test macros for both bugs in the extension chapter of this forum). That prevents me from using JS to avoid double style loading when flipping back and forth in tab history.
And who knows what the future brings. A lot of things are currently changing in KM customizing.

Options: ReplyQuote
Re: how to force backgrund color
Posted by: siria
Date: November 14, 2014 12:32AM

Yet a better example is yahoo.com. Or the news site:
http://de.nachrichten.yahoo.com

When blocking document colors ALL images vanish?!
(or is that somehow another user setting of mine?? So much has accumulated over time...)

And when searching text inside a page and highlighting all hits (Ctrl+F), then the highlight-colors vanish too.
Funnily, I have an extra glaring style for them via adblock.css, and if active the adblock style still seems to work and show!
On the otherhand, when I inject a css style via macro for background-color and text colors, those hits lose the adblock-styling again and look like normal text. So have to add that extra highlighting style in the macro too.

As mentioned before, it all gets awfully complicated, and various methods will be needed on different sites.



Edited 2 time(s). Last edit at 11/14/2014 12:42AM by siria.

Options: ReplyQuote
Re: how to force backgrund color
Posted by: JohnHell
Date: November 14, 2014 01:05AM

You made me test. Looks that now isn't as "the old way", only changing body and text colors.

Now changes the background of everything when set browser.display.use_document_colors to false.

Thanks for that Siria. What I posted above now hasn't much sense. It was based in my previous experience.

I had a macro for almost the same result from years ago xDD


All images vanish because now is more common to use background images. Kind of a way to "avoid" steal images.



Edited 1 time(s). Last edit at 11/14/2014 01:06AM by JohnHell.

Options: ReplyQuote
Re: how to force background color
Posted by: siria
Date: November 14, 2014 01:44AM

Thank you too for testing smiling smiley

Options: ReplyQuote


K-Meleon forum is powered by Phorum.