On Kate Colorschemes and custom highlighting

David Nolden zwabel at googlemail.com
Sun Jan 10 15:49:12 UTC 2010


Am Freitag 08 Januar 2010 14:57:18 schrieb Milian Wolff:
> Hey guys!
> 
> I spent some time to fix the Kate interfaces in order to access the used
> foreground- & background color. This should now make it possible to
>  properly support things like "Dark KDE-Scheme & Bright Kate Scheme" (or
>  vice versa). Afaik there is a bug about this, but I'm sure there were at
>  least two to three people complaining about the current state on IRC.
> 
> I had a look at it and wanted to finally implement the required code in
> KDevelop, but I fear the current API-design makes it very ugly. Let me
> explain:
> 
> - the default background color (all we need for KDevelop) can be accessed
>  via:
> 
> (ConfigInterface of a KTextEditor::View)->configValue("background-color")
> 
> - the above shows that - theoretically - the return value depends on the
>  used KTextEditor::View, but at least for Kate this is not the case (i.e.
>  each view will return the same)
> 
> - KDevelop only highlights the DUChain, i.e. the associated SmartRanges and
> does not know anything about Documents/Views in the highlighting classes
> 
> - the color cache that generates our custom colors is a singleton,
>  currently it only listens to changes in the global KDE color scheme and
>  adapts properly
> 
> 
> Now my problem is: How should I connect these two? It's two totally
>  different APIs... One supports MDI, the other is a singleton...
> 
> I could hack something together like:
> 
> - in the singleton listen to
> - new document created, then listen to
> - view created => check background color
>   - if  valid value returned (i.e. we use KDE 4.4), adapt colors
>   - if invalid value returned, take global color scheme...
> - also listen to configChanged signals of the Views
> 
> I mean this would probably work (and would have a fallback for KDE 4.3) but
> imo it's rather ugly...
> 
> Any ideas? Feedback?
> 
I don't see another way to do it. I think it's ok to assume that all views 
have the same color-scheme, which I guess is anyway the case for kate.

Greetings, David




More information about the KDevelop-devel mailing list