Documentation Buy Contact Blog
Blog

Excel Theme Color Tint

Adam C. Clifton
9 Jun 2020
Excel Theme Color Tint 9 June 2020

Themes in Excel are sets of colours in we can swap between to easily change the appearence of workbooks. From the base set of colors, an additional range of tints are autogenerated, these tints are not defined directly, they are calculated by excel on the fly.

Here you can see the tints change as we change the theme colors:

  

Number Duck is designed to make things as easy as possible for you, the programmer, so we don't clutter up the API with themes. Instead, as the file is loaded, we directly convert the themed colours into normal colors.

But how do we do that?

When referencing themed colors inside an Excel BIFF8 file, the color index inside the theme is used, along with a 16 bit signed int that controls the tint. To get the final tinted color, we convert the base color from RGB to HSL, then apply the tint, then convert back to RGB.

This lets us load themed colours with correct tints, so you can now use them in Excel, and have Number Duck correctly reproduce the results!

Previous: Installing Number Duck on WampServer
Next: JPEG Optimizations