Color

Contain various methods to do Color Detection

Constructor
Color(color: number | string | Color)

Construct a color from its number representation, color string or another Color object

Parameters
color The number representation of the color, the color as a string ("#FFRRGGBB" or "#RRGGBB") or another Color object
Static Methods
get
static Color get(point: Point)

Get the color at the coordinate. Return null if the device fail to capture the screen

Parameters
point The coordinate to get the color
Return
Color The color
getAll
static Color[] get(points: Point[])

Get all the colors at the coordinates. If you need colors at multiple locations, this will be faster than getting the color one by one. Return null if the device fail to capture the screen

Parameters
points The coordinates to get the color
Return
Color[] An array of colors
compare
static number compare(color1: Color, color2: Color)

Compare the two color and return the similarity

Parameters
color1 The first color
color2 The second color
Return
number The similarity between the two color. Range 0 to 1.
compareRGB
static number compareRGB(color1: Color, color2: Color)

Compare the two color and return the similarity. This uses the RGB colorspace for comparing

Parameters
color1 The first color
color2 The second color
Return
number The similarity between the two color. Range 0 to 1.
Methods
value
number value()

Get the number representation of the color

Return
number The number representation of the color
valueString
string valueString()

Get the string representation of the color

Return
string The string representation of the color
red
number red()

Get the red component of the color

Return
number The red component
green
number green()

Get the green component of the color

Return
number The green component
blue
number blue()

Get the blue component of the color

Return
number The blue component
alpha
number alpha()

Get the alpha component of the color

Return
number The alpha component

© 2021 - Macrorify by KoK-CODE