Copy link to clipboard
Copied
I want a script or a way When I have more colors CMYK If (K=1% or 2% or 3% or 4% or 5% convert to K=0% ) & If (K=6% or 7% or 8% or 9% convert to K=10%) Be part of the color and apply the theory to all colors C or M or Y or K
Example:
I have 2 color
Red:
C:5%
M:100%
Y:100%
K:5%
Green:
C:100%
M:6%
Y:100%
K:6%
Convert to ---
Red:
C:0%
M:100%
Y:100%
K:0%
Green:
C:100%
M:10%
Y:100%
K:10%
Note without prejudice to other values.
Applies to many colors
How ?????!
Message was edited by: carlos canto, title edited for clarity
Copy link to clipboard
Copied
Here is the sample code to help you in your work
function round(val) {
return (Math.round(val / 10) * 10);
}
function main() {
var redColor = app.activeDocument.swatches.getByName('CMYK Red'); // make sure CMYK Red swatch exists in the document, and change it for different color.
redColor.color.cyan = round(Math.round(redColor.color.cyan)-1);
redColor.color.magenta = round(Math.round(redColor.color.magenta)-1);
redColor.color.yellow = round(Math.round(redColor.color.yellow)-1);
redColor.color.black = round(Math.round(redColor.color.black)-1);
}
main();
Hope this helps you.
Copy link to clipboard
Copied
Thank you
The script does not work
I would like to have a script for all the colors in the design
Copy link to clipboard
Copied
This is quite easy, you have to run this code in just for loop for all swatches exists in the document. Here is an example.
function round(val) {
return (Math.round(val / 10) * 10);
}
function main() {
var doc = app.activeDocument;
for (var i = 0; i < doc.swatches.length; i++) {
var swatch = doc.swatches;
swatch.color.cyan = round(Math.round(swatch.color.cyan) - 1);
swatch.color.magenta = round(Math.round(swatch.color.magenta) - 1);
swatch.color.yellow = round(Math.round(swatch.color.yellow) - 1);
swatch.color.black = round(Math.round(swatch.color.black) - 1);
}
}
main();
Copy link to clipboard
Copied
Thank you
But not working for all colors
Please explain video or pictures please
Copy link to clipboard
Copied
Could you please specify what type of colors are you using in the document? May be your document have RGB or spot colors. If you can share the document then I may modify the script and also share the video or picture.
Copy link to clipboard
Copied
vector image - CMYK
Copy link to clipboard
Copied
thank you work Script
but I need colors CMYK - Global
Find more inspiration, events, and resources on the new Adobe Community
Explore Now