[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KHTML color scheme patch
From:       Conor W Sullivan <premiersullivan () gmail ! com>
Date:       2008-06-27 1:23:07
Message-ID: 200806261823.07378.ConorWSullivan () gmail ! com
[Download RAW message or body]

Sorry, I meant to send this from a different account

Hi, where is the best place to discuss khtml issues?  The following is a patch 
to kdelibs/khtml/khtml_part.cpp which simply sets the part's color scheme as 
being a generic black-on-white color scheme.  This is because khtml often 
works with webpages that conflict severly with dark color schemes.  I can add a 
system settings option to disable this is you like.  

To see the need for the patch, switch to a dark color scheme and navigate with 
konqueror to a site like this:  
http://www.usenix.org/event/usenix04/tech/freenix/full_papers/faure/faure_html/node5.html
The page is difficult to read because the background is a dark gray.  We can't 
change how sites are written, but we can change how khtml handles it.

My patch fixes sites like this by simply settings the QPalette of the site to a 
generic color scheme.  After applying my patch, the site renders well.  

 However, it seems not to work on oxygen-rendered widgets.   Somewhere in 
khtml code, I think that the QPalette is being overridden.  Look at sites like 
www.facebook.com or www.google.com and see how the text boxes, buttons, etc 
are still light on dark even with my patch.  On some sites , this can be very 
problematic.  Any suggestions on how to make this patch better is appreciated.





["khtmlcolordiff" (text/x-patch)]

Index: khtml_part.cpp
===================================================================
--- khtml_part.cpp	(revision 823328)
+++ khtml_part.cpp	(working copy)
@@ -218,6 +218,19 @@
     KHTMLGlobal::registerPart( this );
     setComponentData( KHTMLGlobal::componentData(), false );
     init( new KHTMLView( this, parentWidget ), prof );
+    
+    QPalette palette(	QBrush(Qt::black), //windowText
+			QBrush(Qt::lightGray), //button
+			QBrush(Qt::lightGray), //light
+			QBrush(Qt::darkGray), //dark
+			QBrush(Qt::gray), //mid
+			QBrush(Qt::black), //text
+			QBrush(Qt::lightGray), //bright_text
+			QBrush(Qt::white), //base
+			QBrush(Qt::lightGray) //window
+			);
+		
+    widget()->setPalette(palette);
 }
 
 KHTMLPart::KHTMLPart( KHTMLView *view, QObject *parent, GUIProfile prof )


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic