SFML community forums

General => Feature requests => Topic started by: Cuban-Pete on July 10, 2011, 09:18:36 pm

Title: Color conversions
Post by: Cuban-Pete on July 10, 2011, 09:18:36 pm
I would like to have the ability to change RGB to HTML (hex) and back to RGB again. But what I would really like is RGB to HSL and back to RGB again.  :)

//edit: Why HSL? Because than I can do color overlay effects like in Gimp.
Title: Color conversions
Post by: panithadrum on July 10, 2011, 10:09:15 pm
I think that a custom function would be the best...
http://www.deadbeef.com/converting_rgb_to_hsv_in_c/
http://serennu.com/colour/rgbtohsl.php
http://130.113.54.154/~monger/hsl-rgb.html
Title: Color conversions
Post by: Cuban-Pete on July 10, 2011, 10:46:59 pm
What would also be nice is an operator on colors. For example that I do this:

Code: [Select]
sf::Color test(20,20,20);

test = test * 1.5;


and we get a brighter test color.  :)
Title: Color conversions
Post by: Cuban-Pete on July 11, 2011, 12:54:04 pm
Quote from: "panithadrum"
I think that a custom function would be the best...
http://www.deadbeef.com/converting_rgb_to_hsv_in_c/
http://serennu.com/colour/rgbtohsl.php
http://130.113.54.154/~monger/hsl-rgb.html


If SFML won't support it, do you perhaps have the c++ code for that (RGB <-> HSL)? I tried google, but got strange C# stuff...
Title: Color conversions
Post by: Cuban-Pete on July 15, 2011, 02:50:37 pm
So no HSL<->RGB convertion function?