Function rgbtocmy () {
my cyan = 255-myred;
my magenta = 255-my green;
my yellow = 255-my blue;
correct cmyk();
}
// CMY to RGB color conversion
Function cmytorgb () {
myred = 255-my cyan;
my green = 255-my magenta;
my blue = 255-my yellow;
correct cmyk();
}
// CMYK color correction
Function correctCMYK () {
If (rep_v! = "ERR") {
var temp = math . min(math . min(my cyan,mymagenta),my yellow);
if (temp! = 0) {
temp 2 = math . round((rep _ v/ 100)* temp);
rep _ k = math . round((temp 2/255)* 100);
rep _ c = math . round((my cyan-temp 2)/255)* 100);
rep _ m = math . round((my magenta-temp 2)/255)* 100);
rep _ y = math . round((my yellow-temp 2)/255)* 100);
} Otherwise {
rep _ c = math . round((my cyan/255)* 100);
rep _ m = math . round((my magenta/255)* 100);
rep _ y = math . round((my yellow/255)* 100);
rep _ k = 0;
}
}