Oh no! I'm so sorry! I thought I had removed that part in the question, and made it "True Color", but I guess that's why I shouldn't write posts in a hurry! Long chain of edits that led to web safe colors. I also cannot seem to find an edit button to fix it!
Thanks for pointing that out btw!
Anyways, thanks a bunch for your prompt responses! You're right - I spent a couple hours yesterday going through almost the entire APIs and didn't see anything that caught my eye. Thought I might have missed out on something. BUT!!!! Progress - I *just* found out that if I account for the tint value, and then edit a current CMYK color to RGB color through the "Swatch Options" window in InDesign, I can get the exact RGB color that I'm looking for. That being said, I'm looking to see whether I can do this:
- Programmatically create a new Color.
- If I'm converting from a Tint instance (CMYK with Tint value), give the newly created color instance the updated (tint compensated) color values in CMYK.
- Or, if it's not a tint, then simply give it the CMYK value.
- Set it's ColorSpace to RGB - I'm hoping this will trigger whatever internal fairy dust is being used.
- Read the new color values
- Celebrate victory.
I cannot seem to find a method to "create" a "new instance of Color", so I'm going to use the "duplicate" method of an existing color, and update it's color values, and use it as a scratch instance for converting all my colors.
If this works, I'll certainly update the post so that the community may make use of it!
Win! It worked!!!
Here's the complete solution -
Assuming the original color is stored in a variable named color:
var color = passedInColor; //the original color that we wish to convert.
// Create a temporary color instance that we'll use to extract updated colorValues.
var scratchColor = workingDoc.colors.add({
model: color.model,
space: color.space,
colorValue: color.colorValue
});
// Now, we force adobe's internal color conversion mechanism to trigger by changing the scratchColor's color space.
scratchColor.space = ColorSpace.RGB;
var updatedValues = scratchColor.colorValue; // Updated values now has the properly mapped and converted RGB values.
// You may need to round off the R, G and B values in the updatedValues array.
// And that's it!
Why am I not surprised that it had to be a hacky work around?! *sigh*. Working on this platform has been so so so frustrating! I do hope adobe gets its act together!