329079209 发表于 2024-1-16 12:57:42

请教PS脚本实现更改前景色为自定义色板号

因为工作需要,有时候要批量的将一些自定义色板中的颜色填充到图层, 所以自己想制作一个脚本来实现,
思路是

1-先将需要的颜色自定义到色板,称是有规律的“色板1”“色板2” “色板3”“色板4”“色板5”“色板6” 但是颜色是会变化的,
2-然后用脚本将前景色设置成“色板1” 背景色设置成“色板2” (动作好像实现不了,只能用鼠标点,)
3-用动作,来填充需要的图层。


在网上我查了一下。只找到这个代码
/弹出窗口询问用户是否更改?
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。 求大神解答一下,有没有可以实现的代码:'(

翻译
搜索复制
页: [1]
查看完整版本: 请教PS脚本实现更改前景色为自定义色板号