Not that I have a solution for you, but figured that I would share some of
my experiences with something similar...

The suggestion of using HSL rather than RGB is a good one, as calculating
this in RGB would be rather hit or miss most likely...  However, I think
perhaps you might want to try calculating the raw chromaticity as CIE xy
coordinates, rather than HSL, and then doing your color conversions from
there.  From the papers that were linked to earlier regarding the topic, it
seemed that the preferred color-space for calculations was LAB, which would
coincide rather nicely to the xyY coordinates.  Many things are calculated
along these lines, perhaps the most common being light/color temperature
using the Planckian Locus: http://en.wikipedia.org/wiki/Planckian_locus.
 Unfortunately as you can see, the algorithms used are rarely 'simple' (at
least to calculate initially), and approximations are often used.
Basically, if you can find a 'curve' on on the color-chart that matches the
color-ranges that you are after, than it just becomes a matter of figuring
out the function(s) that best approximates it.

I have a python/tkinter app that I created that you could take a look at for
an implementation of the above color-temperature scale if it would help you
out.  I won't post all the code here, but you can download it at the links
below.  You'll have to excuse the code however, I make my living as a vfx
artist, and I'm rather a hack when it really comes to coding...  Anyways,
you can find it here:  http://wiki.brianmeanley.com/wiki/LightTools.py .
 For the main code involving the color calculations, look in the
'bhm_color.py' module.  A non-gui version can be found here:
http://www.brianmeanley.com/blog/?page_id=349

Color-science is a pretty hefty subject in its' own right, but it can be an
extremely interesting and 'fun' one too if you take an interest in it.  I
would think that doing a bit of digging into the color temperature
examples/links above might give you some insight into what it is that you
are hoping to accomplish, as well as the other examples that you mentioned.
 I would also highly suggest checking out http://brucelindbloom.com/ for
some good info regarding the math behind most color conversions and more.

Good luck!

-Brian

(PS, sorry if I messed this mailing list thing up, I have never actually
posted to this list before...)
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to