$color 返回
颜色操作
const (int) BLACK
黑色
const (int) DGRAY
深灰色
const (int) GRAY
灰色
const (int) LGRAY
浅灰色
const (int) WHITE
白色
const (int) RED
红色
const (int) GREEN
绿色
const (int) BLUE
蓝色
const (int) YELLOW
黄色
const (int) CYAN
青色
const (int) MAGENTA
品红
const (int) TRANSPARENT
透明
find(img,color,threshold,region)
版本:1.0.0
查找颜色的位置
- 参数 : img {Image} 在指定图片中找色
- 参数 : color {String} 颜色值
- 参数 : threshold {int} 阈值
- 参数 : region {double[]} 范围
- 返回 : {Point} 找到颜色的位置
//(1)截屏
let img = $screen.getScreen();
//(2)在屏幕上找到颜色
let point = $color.find(img, "#a55978", 5, [300, 200, 500, 500]);
if (point != null) {
//绘制出颜色的位置
$draw.cross(point);
sleep(3000);
}
img.close(); //回收截屏图片
$draw.closeAll(); //关闭绘制
find(img,color,threshold)
版本:1.0.0
查找颜色的位置
- 参数 : img {Image} 在指定图片中找色
- 参数 : color {String} 颜色值
- 参数 : threshold {int} 阈值
- 返回 : {Point} 找到颜色的位置
//(1)截屏
let img = $screen.getScreen();
//(2)在屏幕上找到颜色
let point = $color.find(img, "#a55978", 5);
if (point != null) {
//绘制出颜色的位置
$draw.cross(point);
sleep(3000);
}
img.close(); //回收截屏图片
$draw.closeAll(); //关闭绘制
find(img,color)
版本:1.0.0
查找颜色的位置
- 参数 : img {Image} 在指定图片中找色
- 参数 : color {String} 颜色值
- 返回 : {Point} 找到颜色的位置
//(1)截屏
let img = $screen.getScreen();
//(2)在屏幕上找到颜色
let point = $color.find(img, "#a55978");
if (point != null) {
//绘制出颜色的位置
$draw.cross(point);
sleep(3000);
}
img.close(); //回收截屏图片
$draw.closeAll(); //关闭绘制
findAll(img,color,threshold,region)
版本:1.0.0
查找颜色所有的位置
- 参数 : img {Image} 在指定图片中找色
- 参数 : color {String} 颜色值
- 参数 : threshold {int} 阈值
- 参数 : region {double[]} 范围
- 返回 : {Point[]} 找到颜色的位置
let screenImg = $screen.getScreen();
let result = $color.findAll(screenImg, "#d28384", 5, []);
if (result != null) {
for (let index of result) {
$draw.dot(index);//绘制位置的点
$draw.log(index);//屏幕显示位置
sleep(300);
}
//3秒后关闭悬浮绘制
sleep(5000);
$draw.closeAll();
}
findAll(img,color,threshold)
版本:1.0.0
查找颜色所有的位置
- 参数 : img {} 在指定图片中找色
- 参数 : color {String} 颜色值
- 参数 : threshold {int} 阈值
- 返回 : {Point[]} 找到颜色的位置
let screenImg = $screen.getScreen();
let result = $color.findAll(screenImg, "#d28384", 5);
if (result != null) {
for (let index of result) {
$draw.dot(index);//绘制位置的点
$draw.log(index);//屏幕显示位置
sleep(300);
}
//3秒后关闭悬浮绘制
sleep(5000);
$draw.closeAll();
}
findAll(img,color)
版本:1.0.0
查找颜色所有的位置
- 参数 : img {} 在指定图片中找色
- 参数 : color {String} 颜色值
- 返回 : {Point[]} 找到颜色的位置
let screenImg = $screen.getScreen();
let result = $color.findAll(screenImg, "#d28384");
if (result != null) {
for (let index of result) {
$draw.dot(index);//绘制位置的点
$draw.log(index);//屏幕显示位置
sleep(300);
}
//3秒后关闭悬浮绘制
sleep(5000);
$draw.closeAll();
}
similar(c1,c2)
版本:1.0.0
计算相似度
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {double} 相似度
//计算相似度
let result = $color.similar("#1E1F22", "#2B2D30");
log("相似度", result);
similar(c1,c2)
版本:1.0.0
计算相似度
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {double} 相似度
//计算相似度
let result = $color.similar("#1E1F22", "#2B2D30");
log("相似度", result);
similar(c1,c2)
版本:1.0.0
计算相似度
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {double} 相似度
//计算相似度
let result = $color.similar("#1E1F22", "#2B2D30");
log("相似度", result);
similar(c1,c2)
版本:1.0.0
计算相似度
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {double} 相似度
//计算相似度
let result = $color.similar("#1E1F22", "#2B2D30");
log("相似度", result);
toString(color)
版本:1.0.0
颜色值转换为8位字符
- 参数 : color {int} 颜色
- 返回 : {string} 字符串颜色
//转为#00000000
let color = $color.toString(-166780);
str(color)
版本:1.0.0
颜色值转6位字符
- 参数 : color {int} 颜色值
- 返回 : {string} 颜色
//转为#000000
let color = $color.str(-166780);
parse(r,g,b)
版本:1.0.0
解析rgb的颜色值
- 参数 : r {int} 红
- 参数 : g {int} 绿
- 参数 : b {int} 蓝
- 返回 : {int} 颜色值
let color = $color.parse(105, 78, 230);
parse(color)
版本:1.0.0
解析颜色值
- 参数 : color {string} 颜色
- 返回 : {int} 颜色值
//解析颜色值
let colorValue = $color.parse("#1E1F22");
log("颜色值", colorValue);
rgb(red,green,blue)
版本:1.0.0
通过RGB通道获得颜色值
- 参数 : red {int} R通道
- 参数 : green {int} G通道
- 参数 : blue {int} B通道
- 返回 : {int} 颜色值
let color = $color.rgb(105, 78, 230);
argb(alpha,red,green,blue)
版本:1.0.0
通过ARGB通道获得颜色值
- 参数 : alpha {int} A通道
- 参数 : red {int} R通道
- 参数 : green {int} G通道
- 参数 : blue {int} B通道
- 返回 : {int} 颜色值
let color = $color.argb(255, 105, 78, 230);
a(color)
版本:1.0.0
计算[A通道]的值
- 参数 : color {String} 颜色
- 返回 : {int} 数值
let a = $color.a("#357C94");
r(color)
版本:1.0.0
计算[R通道]的值
- 参数 : color {String} 颜色
- 返回 : {int} 数值
let r = $color.r("#357C94");
g(color)
版本:1.0.0
计算[G通道]的值
- 参数 : color {String} 颜色
- 返回 : {int} 数值
let g = $color.g("#357C94");
b(color)
版本:1.0.0
计算[B通道]的值
- 参数 : color {String} 颜色
- 返回 : {int} 数值
let b = $color.b("#357C94");
equals(c1,c2)
版本:1.0.0
比较两个颜色
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {boolean} 是否相等
let color = "#1E1F22";
let colorValue = -14803166;
let same = $color.equals(color, colorValue);
if (same) {
toast("颜色相同");
} else {
toast("颜色不同");
}
equals(c1,c2)
版本:1.0.0
比较两个颜色
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {boolean} 是否相等
let color = "#1E1F22";
let colorValue = -14803166;
let same = $color.equals(color, colorValue);
if (same) {
toast("颜色相同");
} else {
toast("颜色不同");
}
equals(c1,c2)
版本:1.0.0
比较两个颜色
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {boolean} 是否相等
let color = "#1E1F22";
let colorValue = -14803166;
let same = $color.equals(color, colorValue);
if (same) {
toast("颜色相同");
} else {
toast("颜色不同");
}
equals(c1,c2)
版本:1.0.0
比较两个颜色
- 参数 : c1 {string|int} 颜色1
- 参数 : c2 {string|int} 颜色2
- 返回 : {boolean} 是否相等
let color = "#1E1F22";
let colorValue = -14803166;
let same = $color.equals(color, colorValue);
if (same) {
toast("颜色相同");
} else {
toast("颜色不同");
}