PhotoShop 脚本学习05 设置PS前景色与背景色

confirm可弹出窗口,让用户选择是还是否

//弹出窗口询问用户是否更改?
var answer = confirm ("您需要设置前景色和背景色吗?");

if(answer) 
{
    //设置前景色 ,分别设置三个通道
    app.foregroundColor.rgb.red = Math.random()*255;
    app.foregroundColor.rgb.green = Math.random()*255;
    app.foregroundColor.rgb.blue =  Math.random()*255;
    //设置背景色 ,分别设置三个通道
    app.backgroundColor.rgb.red = Math.random()*255;
    app.backgroundColor.rgb.green = Math.random()*255;
    app.backgroundColor.rgb.blue = Math.random()*255;
}

设置为RGB值为0-255随机值,即合成随机色

posted @ 2020-02-03 15:13  编码的奥秘  阅读(335)  评论(0编辑  收藏  举报