How to get DefaultFillColor and DefaultStrokeColor?
Hi all,
I'm trying to fetch the DefaultFillColor and DefaultStrokeColor values back into my code for Adobe Illustrator. I can set these two values just fine by creating a new RGBColor() object and assigning to it, the reverse is proving a lot more difficult.
I am using C# as my coding language but I should be able to convert any other codes like JavaScript or VBScript back to C# if you don't know the language, so any help whatsoever or pointers would be helpful.
The code attempts I'm working with is along the lines of:
using ai = Illustrator;
ai.ApplicationClass app = new ai.ApplicationClass();
var ColObj = app.ActiveDocument.DefaultFillColor;
Console.WriteLine(ColObj);
//Returns System.__ComObject
var ColObj1 = (ai.RGBColor)app.ActiveDocument.DefaultFillColor;
Console.WriteLine(ColObj1.Red);
//Causes exception: Unable to cast COM object of type 'System.__ComObject' to interface type 'Illustrator.RGBColor'. No such interface supported.
Any advice on how to fetch these values in an RGB format, or even better - the Hex color code would be very much appreciated.
