View Single Post
Author Message
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 11-10-2017 , 21:11   [INC] Colour Manipulation
Reply With Quote #1

Made a small .inc file that has some basic functions for manipulating colours and interpolating them, because interpolating in rgb is yuck.

Can convert from RGB to HSV, and HSV to RGB. Range of values for the HSV is [0,255] for all the values, not [0,100] or [0,360] which some people might be expecting.

Also included a function to do some basic linear interpolation between 2 colours, and a seperate function for interpolating between 2 HSV colours. Since the Hue value is an angle and can wrap around, it needs to be interpolated a bit differently.

Finally, functions that takes an RGB or HSV colour and convert it to the hex string, e.g. (255, 0, 0) -> "#FF0000"

Hopefully someone else whos looking for this stuff doesn't have to go through same trouble I did to get effects they're looking for.
Attached Files
File Type: inc colourmanip.inc (3.2 KB, 171 views)

Last edited by hmmmmm; 11-10-2017 at 21:16.
hmmmmm is offline