Working with Themes – Part 2

In my last post, I introduced the topic of working with themes in Power BI.  I ended the post by showing how to use the built-in themes supplied with Power BI.  Microsoft recently doubled the number of built-in themes specifically to add more themes with higher contrast colors.  Why the concern about higher contrast colors?

Color Blindness 

Perhaps you never thought about it, but over 6% of the population is color blind or has some difficulty with perceiving some colors.  There are three major types of color blindness.

Protanopia – Red-Green color blindness relates to an individual’s sensitivity to red or green light. 

Deuteranopia – Also a red-green color blindness that is most common form and is found in 6% of males. 

Tritanopia – Blue-Yellow color blindness results in these individuals confusing blue with green and yellow with violet.

One of the best free software tools that you can download and check your color choices with is Colour Contrast Analyser.  This tool lets you sample the colors of foreground text and background colors to see what the contrast between them are.  Typically, you should have a contrast ratio of at least 4.5:1 between the text font color and the background for compliance at the AA level.  This should be your minimal goal. You should note that the higher the first number, the greater the contrast. For example, black text on a white background is a 27:1 color contrast ratio. Anyway, you can drop as low as a 3:1 ratio for larger text that is over 18-point or over 14-point bold text.  At the higher AAA level compliance, these numbers increase to 7:1 and 4.5:1 respectively.  Now if you knew how to calculate the color contrast ratio from the RGB values of both colors, you could perform this test without resorting to a separate application.  But if you are like me, that is too much effort especially when there is a free tool.

However, another benefit of this tool is that it can show you a simulation of what people in each of the three color-blind scenarios would see.  I find this fascinating to look at and extremely useful when selecting colors.  The following figure shows an example of the app’s screen.

The main Colour Contrast Analyser Tool Screen showing contrast values for different types of color blindness 

Notice how both types of red-green color blindness results in shades of grey.  The effective color contrast ratio is calculated for each of the three-color blind scenarios as well as the ratio for normal vision. In any case, all three types of color-blind scenarios in this example page have sufficient contrast between the text or foreground color and background color.  However, consider that you should not rely on color alone to signify a meaning as both green and red, often used to signify good and bad, may not be obvious to red-green color-blindness sufferers as they will interpret both colors as shades of grey.

If you think you could use this tool to help select colors, you can find it at:  

So far you have learned about using different themes which may change some of the colors displayed in your visualizations.  If you have data labels that perhaps appear inside bar or column charts or the slice of pie charts, you are expected to ensure that the font contrast is clearly readable with sufficient contrast for all.  There are some ‘tricks’ that can be used to resolve contrast problems that I will cover in a later post. 

The Theme Gallery 

Last time I talked about using one of the built-in themes.  This is perhaps the easiest way to apply different color themes to your work.  However, dozens if not hundreds of themes have been created by third party Power BI users.  Some of these have been submitted to Microsoft and posted in an area on the Microsoft web called the Theme Gallery.

Before you do anything else, save your Power BI file just in case you need to revert to the original color template before you chose a different theme.  Next, to open the Theme Gallery, click View to activate the view ribbon, then click Themes. Then click the Theme Gallery option from the options at the bottom of the dialog as shown in this figure.

The View Dialog contains all the options for working with Themes in Power BI 

The Theme Gallery shows you several available themes from third-party developers.  While some are quite good, others may not have enough contrast to meet the ADA requirements of your pages. Remember that depending on whether you have colored page backgrounds or images for your background, contrast ratios will not be the same as when those same colors are displayed on a white background.  However, with 12 themes to a page and nearly 10 pages of featured themes currently, you still have over 110 themes to choose from.

The Theme Gallery found on Microsoft's website allows you to download and use 3rd party contributed themes. 

So how do you use these themes in your reports?  Page through the themes to find one you like. Then simply click on the sample image of the theme at the top of each one.  This action displays another page with an enlarged view of what the theme looks like in a sample report.  If you still like it, go to the bottom left of the page and find the .json file with the name of the theme and click the download button to the right of the name.

Each theme has a page that lets you inspect the theme and down the JSON file for it. 

You then have to indicate where on your computer you want to down and store the .json file.  I prefer to keep all my Power BI themes in a single folder under a folder named PowerBI and subfolder Themes, but that’s just me.  You can store the file anywhere you like as long as you can find it later.

Next, go back into Power BI and under the View ribbon, open the theme dropdown again (by clicking the arrow box to the right of the displayed themes in the View ribbon) and select Browse for Themes.  This is why you needed to remember where you downloaded the theme file.  Notice that you can access any folder on your hard drive, on a connected network drive, or perhaps on your OneDrive cloud storage.

Once you select a theme and click the Open button, Power BI loads the theme and automatically updates your visuals to use the new theme colors.  If there were no problems (like syntax issues) with the theme file, you will see something like the following screen.

After importing a theme into a Power BI Report, all report elements are automatically updated. 

To keep the theme change, click the Close button or the ‘X’ in the upper right corner.  If, on the other hand, you do not like the way theme looks with your data, simply close the file without saving it and reopen it to see your report displaying the previous colors.  Now you know why I said to first save your Power BI file.

Well, that is all we have time for today.  Have some fun trying some of the different themes from the Theme Gallery with your own Power BI reports.  Just remember to first save your Power BI report in case you choose a theme that you don’t like or perhaps displays a low contrast with with a page background color or image.

Next time, I will look at a new feature added to Power BI in December 2019 that allows you to customize individual colors of many of the elements of your visuals without having to know any JSON. 

See you then.