UI组件
$color

$color

存储颜色数据,包括不透明度。

$color(colorStr:string)

解析颜色字符串,返回颜色值。如果解析失败,则会抛出异常。

允许的格式有以下两种:

#RRGGBB
#AARRGGBB
{
    type: "text",
    props: {
        text: "Hello, OneScript!",
        textColor: $color("#FF0000"),
    }
}

内置颜色常用颜色:

let color = $color("red")
名称颜色
black黑色
darkGray深灰色
gray灰色
lightGray浅灰色
white白色
red红色
green绿色
blue蓝色
yellow黄色
cyan青色
magenta品红色
transparent透明色

$color({light:string,dark:string})

同时设置浅色模式和深色模式下的颜色值

{
    type: "text",
    props: {
        text: "Hello, OneScript!",
        textColor: $color({light:"white",dark:"black"}),
    }
}