MacroMonkey.com - Home

Automation - Macro - Bot - Scripting system.



Color Support:

Color conversion and utility library.


colorrgb = color.RGB(r, g, b)    Assemble red, green, blue components into a color value. Component range 0 to 255.

r =color.R(rgb)     Return color component from a composite rgb color value for Red, Green, and Blue respectively.

g = color.G(rgb) “”

b = color.B(rgb) “”


delta = color.DeltaRGB(rgb1, rgb2)    Return the relative difference between two composite rgb colors.

0 = Same, 1.0 = Maximum difference.


Example:

-- Return true if color is green

function IsGreen(rgb)

    if color.DeltaRGB(color.RGB(0,255, 0), rgb) < 0.1) then return(true) else return(false) end

end


h,s,l = color.RGBtoHSL(r, g, b)    Convert RGB color to HSL (Hue, Saturation, Lightness) color space

components. Components: h range: 0 to 360, s and l from: 0 to 1.0,.

r,g,b = color.HSLtoRGB(h, s, l)    Convert HSL color to RGB (Red, Green, Blue) color space components.

See: http://en.wikipedia.org/wiki/HSL_and_HSV