How To Discover Undocumented Theme Settings in Power BI Desktop
One of the many benefits of Power BI is the possibility to create your own theme file, which defines many design properties of a report, like colors, fonts, and many more. There are also tools on the internet that help you to create such a theme file. But, as you will see, there are some undocumented theme settings. This blog post is about those.
The corporate design
I work for a company which has its own corporate design. There are templates for Word, PowerPoint, newsletters, and so on. But we didn’t have an official one for reports in Power BI.
We went to our UX department and asked for a style guide. We started reading it and we were astonished how many requirements there are. But we saw immediately that every detail makes sense. We started to create a pixel perfect corporate design template in Power BI with a grid, fonts, colors pallets and all the UX stuff.
Tools on the internet
The best place to start is the Report Theme Generator v3. You can create a color palette. You can also define global settings for all visuals and many custom settings for standard visuals. Unfortunately, the generator misses some settings. Maybe because the last version dates back to January 22nd, 2018.
The Report Theme Generator helps with the basics, but you have to visit the Microsoft’s official documentation Use Report Themes in Power BI Desktop soon. I highly recommend that you read the whole document, if you haven’t, yet. The part which is important for this article starts at the list of properties within each card. I have copied out few lines to show you what is written in the documentation, see below.
"Select the location for the legend"
When we transform this documentation snippet into a valid JSON theme file, it will look like this:
Using this JSON snippet, we have defined a legend which is on the left-hand side of a chart. This way you can write a thousands of rows long JSON file which defines every small detail of your design. Which is great if you have strict requirements.
Unfortunately, Microsoft’s official documentation doesn’t contain all properties which can be set up in Power BI Desktop. Maybe, it is only a matter of time.
In many cases you also do not know what value you should set. Can I use Left and Right for position property only or are there more options? In some cases, the description enumerates the possible values, e.g. “Select left or right” from value axis position property, but not always.
The undocumented properties
As I have already written, there are some properties which aren’t documented but can be set in the Power BI Desktop. One of them is the lineWeight of an icon.
Let’s find out how to get the property name. First, create an empty Power BI file, add a visual, set all the properties you want, save the file, and close Power BI Desktop. Next, you rename the file from *.pbix to *.zip and unzip the file. A detailed description of all files in the unzipped folder can be found here. You are interested in the file Report/Layout in which all visuals of the report sheets are defined. Open the file in your preferred editor and format it as JSON.
Then, navigate to the page with your visuals and find the visual you want to analyze. Go to the config property and copy its content. Replace \” with “ and format the JSON code again. You will get the following:
As you can see in the screenshot above, the property is called lineWeight and its value is an integer. Now we can start setting this property in our pixel perfect design template.
Thanks to this intensive work with theme files I have learned many new cool features of Power BI Desktop. My favorite one is a theme for the new filter pane. I have created a crazy one with Comic Sans font to see a difference at first sight. The documentation to the filter pane and the cards theme file can be found here.
That is enough for today and I wish you a great time while creating new templates. Your users will appreciate it.