[Addendum, 06/04/2012] — I must credit Jongware for his original discovery of previewColor (the trick behind StyLighter). Indeed, my irreplaceable colleague had already detected and discussed this hidden property in the InDesign Scripting Forum. See also this all-important note from Ashley Mitchell, who “was part of the InDesign team that implemented this feature back in CS4.”


Two years ago we discovered a secret key that allows to magically highlight paragraph and/or character style overrides in InDesign. This was good news for ePUB designers and generally those InDesign users who aspire to the cleanest document structure and formatting. However, we did not go through with the demonstration!

In essence—and to make a long story short!—InDesign CS4 and later offers a very special Preview Mode dedicated to styles. This mode is only available and disclosable by a script command: TextPreference.enableStylePreviewMode = true. I don't know why InDesign developers decided to hide this feature (which by the way remains secret in CS6 and CC) but there are good reasons to believe that the intended functionality has been only partially implemented so far, if not aborted. Digging that topic, I hit on another obscure property you've probably never heard of until today: previewColor, which regards ParagraphStyle and CharacterStyle objects. Also available since CS4, this parameter expects a UIColors enum (or a RGB triplet, theoretically!) which has no visible effect… unless the Style Preview mode is enabled!

Can you guess what follows?

Paragraph and character styles automatically highlighted with custom colors in Style Preview mode. (No underline is used!)

Ta-da! I swear that the above screenshot is not based on any colored underline. Instead, I applied a specific previewColor value to each paragraph or character style I wanted to highlight. Note that red lines (character styles) and red vertical rules (paragraph styles) still mark all the overrides. So we now see the Style Preview Mode feature in all its magnitude.

StyLighter, the Style Preview Manager

From there, my whole problem was to fully expose this magic feature in the InDesign UI. Confident, I started by designing a nice script interface that provides a subtle control of each color assignment and allows the user to selectively enable / disable preview on specific styles—while storing the last used settings.

This looked very promising, except that some colors were improperly assigned, or simply ignored! I finally figured out, on the one hand, that the previewColor property only supports the restricted set of UIColors—contrary to what the DOM claims arbitrary [R,G,B] triplets are not implemented—and, secondly, UI color assignments are out of sync since CS5. For example, UIColors.CYAN is rendered as UIColors.VIOLET in InDesign CS5, CS5.5 and CS6. Based on various tests, it appears that a shift of 8 items is systematically applied, but under some circumstances such as IDML export/re-import, the wrong offset falls to 2!

I tried to get around all these technical complications as much as possible, but the resulting script is de facto doomed to somewhat brittle. I hope this script can still be of some service. StyLighter has been roughly tested in InDesign CS4, CS5+, CS6 (Mac and Win). Give it a try!

• See also: Show Local Formatting in InDesign CS4/CS5