Contain various methods to do Color Detection
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 |
CIE76: number = 0
CIE94: number = 1
CIE2000: number = 2
RGBA: number = 3
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 |
static Color[] get(points: Point[] | Region)
Get all the colors at the coordinates or inside the Region. 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. If the input is a Region then all points inside the region will be used |
| Return | |
| Color[] | An array of colors. If use a Region then the array will have the colors of the region row by row |
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. |
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. |
static number deltaE(color1: number | string | Color, color2: number | string | Color, method: number = 0)
Returns the deltaE between two colors. Note that CIE94 and CIE2000 are not yet supported
| Parameters | |
| color1 | The color to compare |
| color2 | The color to compare |
| method | One of the CIE76, CIE94, CIE2000, RGBA |
| Return | |
| number | The detaE |
bool isSame(color: number | string | Color, method: number = 0)
Check if the current color is the same as the input color. Delta E metric is used with the predicate of dE <= 10. Note that CIE94 and CIE2000 are not yet supported
| Parameters | |
| color | The color to compare |
| method | One of the CIE76, CIE94, CIE2000, RGBA |
| Return | |
| bool | true if dE <= 10 |
bool isExact(color: number | string | Color, method: number = 0)
Check if the current color is exactly the same as the input color. Delta E metric is used with the predicate of dE = 0. Note that CIE94 and CIE2000 are not yet supported
| Parameters | |
| color | The color to compare |
| method | One of the CIE76, CIE94, CIE2000, RGBA |
| Return | |
| bool | true if dE = 0 |
number value()
Get the number representation of the color
| Return | |
| number | The number representation of the color |
string valueString()
Get the string representation of the color
| Return | |
| string | The string representation of the color |
number red()
Get the red component of the color
| Return | |
| number | The red component |
number green()
Get the green component of the color
| Return | |
| number | The green component |
number blue()
Get the blue component of the color
| Return | |
| number | The blue component |
number alpha()
Get the alpha component of the color
| Return | |
| number | The alpha component |
© 2025 - Macrorify by KoK-CODE