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

て烟熏妆下的殇ゞ 提交于 2020-02-03 15:35:52

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随机值,即合成随机色

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!