blend function urgently needed in kdelibs

Hans Meine hans_meine at gmx.net
Wed May 23 13:15:58 BST 2007


Hi Matthew!

Am Dienstag, 22. Mai 2007 21:17:15 schrieb Matthew Woehlke:
> > I implemented a custom method for calculating a darker color, with a
> > fallback of having a lighter color if there is not enough contrast (see
> > [1] at the end of the mail, the code is in
> > kdebase/apps/dolphin/statusbarspaceinfo.cpp). I'm not sure whether it's
> > worth to make those kind of method accessable in a generic way, but maybe
> > you get input from other application developers too.
>
> As you guess, there are usability/style needs for this as well, 'get a
> contrasting color with a preference for making it darker' is a common
> need. I will probably write a darkContrast() function but I'm not sure
> if it will go in KColor or wherever gets the usability functions. Anyway
>   kcolor.luma() can still help out here by giving you the true
> gray-value of a color to decide if you want to darken or lighten.

Actually, I am no core developer, but my own opinion concerning this whole 
thread has not been expressed by anyone else yet.

I am not sure it is the right thing to hastily push a blend function into the 
public API right now.  The problem could be that once you introduced the API, 
you are forced to leave it the way it is, or make only BC changes.

I agree that blending functionality is needed, and that there are enough use 
cases, but my fear is that a "blend function" is not defined clear enough.  I 
see that you have indeed provided some API and that you are working on it, 
but that still looks quite unfinished (to me, no bashing intended).  Your 
recent posting on a KColor::darkContrast() looks sensible to me though - if 
you can find such a high-level API that fits the needs of applications, that 
would be ideal AFAICS.

So I propose to collect concrete existing code examples and try to find a 
common scheme, like the need to "highlight" some text, while preserving 
contrast with the background.  Then I would prefer an API that allows you to 
formulate just that, and does not require the application developer to care 
about color spaces or the like.

Just my 2 and a half cents.

Greetings,
  Hans




More information about the kde-core-devel mailing list