Wednesday, November 09, 2005

InDesign CS2: Inherit a Color

I'm currently working on a book about using XML/XSLT with Adobe InDesign CS2. I have worked with the program and its competition like Quark XPress and FrameMaker (no link here since the Mac version ceased to exist) for quite some time now and I think that the XML support has matured quite a bit. It's not FrameMaker yet, but I keep my hopes up high that the program will eventually get there.
There is one aspect of the Character Formats which puzzled me, though. I could not find a way to change the color of such a format to nothing, the setting the format uses when it is created. If you change the color-assignment for the format in the GUI once, there is no way to get back to nothing, means the color from the enclosing paragraph format is inherited. Sure, one could simply create a new format and exchange it for the now non-working one. But in my case, the format is used (and mis-used) in a number of ways and I really don't want to check in all the places. So I came up with a simple AppleScript to do the switch:

tell application "Adobe InDesign CS2"
set myDoc to document 1
tell myDoc
set myCharFormat to character style "insert_cstyle_name"
set the fill color of myCharFormat to nothing
end tell
end tell

Yes, I know that this could have been done in a single line, but this line would not fit in this layout. (It might not fit on certain browsers anyway.) But still, here you go, switching back to nothing.