Bug 53885

Summary: [testcase] khtml should NOT use "standard background" and "standard text" settings from colour scheme
Product: [Applications] konqueror Reporter: Paul Hoepfner-Homme <ahd9ryi02>
Component: khtml rendererAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: bugzilla, chris, daniel.hill, finex, flami, Henning.Fleddermann, jgelens, maarizwan, maurizio.colucci, pch1, rafl
Priority: NOR    
Version: 3.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: A screenshot of Konqueror displaying a popular website when a non-standard KDE colour scheme is chosen
Testcase rendering some sample text with background not set (transparent)

Description Paul Hoepfner-Homme 2003-02-02 08:45:27 UTC
Version:            (using KDE KDE 3.0.99)
Installed from:    Gentoo Packages
Compiler:          gcc 2.95.3 
OS:          Linux

When a user has a nonstandard colour scheme - well, any theme having non-black text and non-white background, which is a lot of them - Konqueror displays many websites not as the website designer intended, and often are illegible, particularly when text is light and the background is dark. This is because if a website does not specify font explicitly, Konqueror falls back to the settings of the colour scheme, namely the "standard background" colour for the background, and "standard text" colour for the text.

This should never be the case. Khtml should have two other colour settings - which I believe should not be stored in the KDE colour scheme, but rather be separate settings for khtml itself - called "standard HTML background" and "standard HTML text", for example. Khtml should not use the "standard background" and "standard text" settings from the colour scheme as it is currently doing; otherwise users with dark themes will continue to have a lot of trouble reading pages that were meant to be rendered with a white background and black text. (Many pages just look like sh*t in Konqueror when you have a dark theme, hence the attached screenshot.)

I realize that there are two other bugs in the KDE Bugzilla that have made a similar complaint: bug #36434 and bug #10441. However, the first of these was opened in 2001, is still marked unconfirmed, and has a "wishlist" priority, and the second of these was closed because the developer "could not reproduce the bug."

This is a major bug, not something for the wishlist. See the screenshot, for goodness sake. It drives me nuts having to select all a page's text just so I can read what it's saying. You may ask, "Then why don't you just change your colour scheme so that you have black text on a white background?" Well, it so happens that my laptop screen is more legible with a dark background and light text, so I prefer to keep my scheme as it is. Besides, in my view, the scheme looks quite sleek.
Comment 1 Paul Hoepfner-Homme 2003-02-02 08:50:12 UTC
Created attachment 860 [details]
A screenshot of Konqueror displaying a popular website when a non-standard KDE colour scheme is chosen

Here is what http://www.pcfinancial.ca/ looks in Konqueror when you have chosen
light text and a dark background in the KDE colour scheme. Konqueror should not
use those values for the default HTML text and background colours, but rather
have its own colour settings, which are, respectively, black and white by
default. As you can see, the website looks very sh*tty.
Comment 2 David Menday 2003-03-27 14:57:01 UTC
I had the same problem with sites setting new background colour and at the same  
time not setting new text colour, fairly common I am afraid. See for example  
http://www.tbray.org/ongoing/  
Note that I had to exit Konqueror and start a new one to actually see the error,  
for some reason refresh did not help (after I changed the colour scheme).  
I am running kde 3.1.1 on gentoo.  
One colour scheme with white text and dark green background is Digital CDE.  
Comment 3 Kai Lahmann 2003-06-14 17:21:48 UTC
hell, yes - we have enoght dups on this: 34248, 47320 (and at least one other) 
Comment 4 Kai Lahmann 2003-06-14 18:52:17 UTC
*** Bug 34248 has been marked as a duplicate of this bug. ***
Comment 5 Kai Lahmann 2003-06-14 18:52:23 UTC
*** Bug 52610 has been marked as a duplicate of this bug. ***
Comment 6 Kai Lahmann 2003-06-14 18:54:26 UTC
*** Bug 23963 has been marked as a duplicate of this bug. ***
Comment 7 Kai Lahmann 2003-06-14 21:47:28 UTC
*** Bug 57183 has been marked as a duplicate of this bug. ***
Comment 8 Jelmer Feenstra 2003-10-14 20:43:03 UTC
Let's just say, I can confirm this bug and know it has been present for ages. 
I have spoken to Dirk Mueller about this and he has tried to fix it. However, 
it's still broken and the solution should be, as is mentioned in the report, 
standard colors for khtml (text black, background white, links blue, visited 
links red, buttons, textforms etc 'normal' colors). 
Comment 9 Stephan Kulow 2003-11-01 10:33:04 UTC
*** Bug 36434 has been marked as a duplicate of this bug. ***
Comment 10 Chris Lee 2003-12-27 00:44:54 UTC
For what it's worth, I believe you could work around this by specifying a custom stylesheet and setting colors in the stylesheet for INPUT and SELECT elements.
Comment 11 Maksim Orlovich 2004-06-10 23:17:04 UTC
*** Bug 74905 has been marked as a duplicate of this bug. ***
Comment 12 Martin Traverse 2004-08-11 19:43:22 UTC
On a related note, "standard HTML background" and "standard HTML text" colour settings could perhaps also be applied to other applications displaying printable documents, the one I have in mind being KWord. I like using dark colour schemes and it annoys me greatly that KWord draws my documents in deep purple/green/whatever colour takes my fancy that week. I know this is something that could be fixed per-application, but having global settings for "standard document background" and "standard document text" that could then be used by the HTML renderer, word processors and anything else seems sensible to me.
Comment 13 Lari Temmes 2005-10-20 14:10:22 UTC
This, i would say VERY annoying problem still exists in KDE 3.4. Because so many websites assume that default background colour is white, it's almost impossible to use konqueror for web surfing when user has custom colour scheme. Please fix this :I 
Comment 14 Laurie Bradshaw 2006-04-26 07:47:23 UTC
Also experiencing this problem, don't mind using a user-defined stylesheet for custom form element colours at all (they are useable with dark colours, just don't fit the colour schemes of sites that assume unspecified is light grey ;), but as khmtl currently (3.5.2) seems to default to black text when unspecified, wouldn't it make sense (or at least be legible) to default to a white background if that is unspecified?
Comment 15 Laurie Bradshaw 2007-04-29 22:39:45 UTC
Still present in 3.5.6....

I've read quite a few postings about this bug, and appreciate that using the system background colour is correct. However this doesn't fit the use-case scenario of:

a. good web designers specify a background colour using css (no problem either way).
b. bad web designers assume the default background colour to be white.

User css is currently not an option due to the unique handling of the body element (margins are also coloured in the body colour, unlike any other element), and the rampant use of the deprecated bgcolor body attribute, which does not override user css.

Applying a colour to the html element using user css results in white borders round the body element (which can occasionally occupy a large portion of the page), and applying a colour to the body element using user css results in breakage of sites that are still using the bgcolor attribute.

My suggestion to solve this issue is to make sure the special handling of the body element happen whether the html element has a css specified background or not, making user css a viable solution for those wishing to use a 'non-standard' system colour scheme yet have black on white (or any other colours for that matter) as default colours for web pages.

In the meantime, for those who just want a fixed white background now:

--- khtml/rendering/render_box.cpp~	2007-04-29 21:37:09.000000000 +0100
+++ khtml/rendering/render_box.cpp	2007-04-29 21:37:11.000000000 +0100
@@ -323,7 +323,7 @@
     }
 
     if( !bgColor.isValid() && canvas()->view())
-        bgColor = canvas()->view()->palette().active().color(QColorGroup::Base);
+        bgColor = QColor(255, 255, 255);
 
     int w = width();
     int h = height();
Comment 16 Michael Leupold 2008-04-06 01:01:39 UTC
Created attachment 24213 [details]
Testcase rendering some sample text with background not set (transparent)
Comment 17 Michael Leupold 2008-04-06 06:15:43 UTC
Confirmed in trunk r793971. New testcase added (ofc needs the KDE background set)
Comment 18 Jos Ewert 2008-07-04 17:02:59 UTC
Still present in 4.0.84, this might be the biggest nuisance in Konqueror.
Because you cannot expect every website to have a perfect style information, i think it is important that  they are rendered the same way as most web browsers do, (which is what web designers expect ) that would be white background , black text. Or make it completely customizable. The way it is now ( and apparently been for 7 years ) is not the right solution.

PS:
Also right now, I am using the additional comment box on this page, i have a dark text field , and somehow the text is black , so I'm typing blind , but Dots, comas, numbers appear in white.

Comment 19 Hannes H 2008-08-18 13:04:03 UTC
Still here in 4.1.0.

Overall I really digg the much improved support for dark color schemes in KDE4. Many things work much better than with kde3, e.g. katepart gets a useable theme as well.

However Konqueror copes rather badly. Of course, it would be nice, if all web-pages were programmed right, but until that is the case, I would really like to use Konqueror....

Please add a Checkbox to SystemSettings that reads something like this:
[ ] Use Color-Scheme for KHTML-Part and WebKit-Part

Thank you very much!

P.S.: This issue was first reported for Konqueror2 IIRC ;)
Comment 20 Daniel 2008-08-24 03:43:20 UTC
https://bugs.launchpad.net/ubuntu/+source/kdebase/+bug/260572

posted a bug for it on kubuntu, i would be nice if the Dev acknowledged the existence of this bug

sure this may technically not be a bug, (actually using generic font colours and an inherited back ground colour is inconsistent. either, or but not both should be the way, so perhaps it is a bug), but the day that every web page complies with w3c guide lines( these are only guide lines as well not rules), is the day pigs fly
Comment 21 Peter Hokanson 2008-10-01 00:45:05 UTC
Still present in KDE 4.1.1 on Gentoo (from kde-testing), but I've seen it since the KDE3 series.

This actually applies to more than just background color, as KHTML uses the standard widgets inside the page.  For example, the box I'm typing in is almost white-on-white because of my color scheme.

Is it not possible to just fix the default colors for KHTML (text + background) to something sensible?  It seems weird that this has been around this long without even a simple fix.
Comment 22 Peter Hokanson 2008-12-18 07:21:23 UTC
I've been trying to adjust the default CSS file, and I've had some success.  I see no reason that the defaults for web-related stuff shouldn't be black text on white background, and I think removing all of the ties between the default CSS and the user's color scheme would be a fair and rather easy solution to this.  If I get something solid I'll post a patch.

On a side-note, the last modification to the default stylesheet is copyright 2003, which is when this bug was filed (and it's still "NEW").  Has anyone looked at this since?
Comment 23 Rafael Leal 2009-01-14 14:39:56 UTC
Does it work if you create a default.css with the text:

body  { 
background-color:white;
color:black
}

And go to Settings > Configure Konqueror > Appearance > Stylesheets and point it to this document in "Use user-defined stylesheet"?
Comment 24 Jos Ewert 2009-01-14 16:39:14 UTC
> Does it work if you create a default.css with the text:

I just tried the css, but it seems that it is ignored. standard apache directory listings are still black text on dark background.

Also the "accessibility stylesheet" is ignored, I set it to white Background, black text, but nothing has changed compared to the default stylesheet.

I looked at : kde4libs-4.1.2/doc/common/kde-default.css

and the 1st  block says:

body {
  background: white none;
  color: black;
  ...
}

I assume this is the one konqueror uses when it is set to "use default stylesheet".
I'm wondering why it ignores the stylesheets.
Comment 25 Jos Ewert 2009-01-14 17:02:22 UTC
I just edited "kde-default.css" by removing the "none" in the 1st block to :
body {
  background: white;
  ...
}

and used it in the stylesheet settings . 
I restarted konqueror and my directory listing had a white background.
( but it seems to make the google.com copyright notice move from the middle to the bottom left. )
I tried to use the accessibility css again and it works too, but it seems to suppress background images , even though i disabled suppression of those.

The css posted by Rafael Leal  does not work.


PS:Im sorry that I was a bit hasty with my previous message
Comment 26 Maksim Orlovich 2009-01-14 17:46:15 UTC
There is a bug with accessibility stylesheets in 4.1.2. Not sure which version I fixed it in (assuming I didn't forget to commit the fix).
Comment 27 Rafael Leal 2009-01-14 18:29:21 UTC
I'm using Konqueror 4.1.96 (4.2rc1, Kubuntu Intrepid)
The css I posted works here.
Comment 28 Henning Fleddermann 2009-02-19 19:57:18 UTC
(In reply to comment #23)
> Does it work if you create a default.css with the text:
> 
> body  { 
> background-color:white;
> color:black
> }
> 
> And go to Settings > Configure Konqueror > Appearance > Stylesheets and point
> it to this document in "Use user-defined stylesheet"?
This works for me using KDE 4.2 on Gentoo x86_64. Thanks.
Still it'd be nice if the devs would fix this problem in kde out of the box. Hannes Hauswedell's idea sounds reasonable.
Comment 29 FiNeX 2009-09-08 15:12:21 UTC

*** This bug has been marked as a duplicate of bug 47320 ***
Comment 30 FiNeX 2009-09-08 15:13:22 UTC
Please, all voters of this bug should vote for bug #47320.