Search code examples
ms-wordoffice-jsadd-in

How to define custom highlight color?


I'm able to highlight text but I'd like to use custom highlight colors. Even if I define custom colors, Word seems to use one of the colors in the default palette that it thinks is closest.

myRange.font.highlightColor = "#ffcc00"; // Should be orange. Comes out red 

That color should come out orange but it comes out red. Any ideas?


Solution

  • Word does not support custom highlight colors - only the traditionl, basic sixteen colors. This is a limitation of the Word application, not the Office JS APIs.

    It would be possible to apply custom colors using Shading, however (as in borders and shading).