Copy link to clipboard
Copied
Hi,
I have a Javascript Problem. I created a script that exports an vector icon in different formats, for print (eps and ai) and for web (png and svg). My Original DocumentColorSpace is CMYK.
When I export the web files the colors deviate from what I defined in the file, because the DocumentColorSpace is still CMYK and not RGB. I can only change it if I create a new document. Is there another way?
var grey = new RGBColor();
grey.red = 124;
grey.green = 131;
grey.blue = 132;
var param = bks.name.split('.');
realDocName = param[0];
file = preffix+filepreffix+realDocName+'_grau'+suffix;
folder = preffix+foldername;
var f = new Folder(bks.path + "/" + folder);
if (!f.exists)
f.create();
var saveName = new File ( f + "/" + file );
bks.exportFile(saveName, type, optionsSVG);
bks.close(SaveOptions.DONOTSAVECHANGES);
bks = null;
app.open (fullDocName);
bks = app.activeDocument;
1 Correct answer
Hi,
You can change the document color space from CMYK to RGB using following command
app.executeMenuCommand('doc-color-rgb');
and from RGB to CMYK using
app.executeMenuCommand('doc-color-cmyk');
Let us know if this helps you.
Thanks
Explore related tutorials & articles
Copy link to clipboard
Copied
Hi,
You can change the document color space from CMYK to RGB using following command
app.executeMenuCommand('doc-color-rgb');
and from RGB to CMYK using
app.executeMenuCommand('doc-color-cmyk');
Let us know if this helps you.
Thanks
Copy link to clipboard
Copied
Thank you so much. It worked like a charm.

