Skip to content

How to Set Custom Color Themes in Microsoft Power BI How to create custom themes in Microsoft Power BI

When publishing internal and external reports for your business it is important to be consistent with your branding standards by using the same color schemes and logos. Microsoft Power BI it a great tool for creating and publishing dynamic and interactive reports and it allows for the customization of colors to match your brand standards. This blog will provide instructions on how to use Microsoft Power BI to create reports you are proud to share.

Creating a JavaScript Object Notation (JSON) File

Power BI allows for a report creator to set the colors used on each visualization manually, and although this creates the desired result, it is time consuming. To set custom report color themes quickly and easily in Power BI that can be used repeatedly, you will need to enable the color themes option and create a simple JSON file of your preferred colors. If you haven’t worked with JSON before or don’t have experience writing code, have no fear; anyone can write the JSON needed for this simple customization.

  1. Enable Custom Report Themes

First, you need to enable custom report themes in Power BI using the desktop version of Power BI. Open a new Power BI desktop file. Select the File menu, click Options and settings, and select Options.

Figure 1 - Power BI File Menu
Figure 1 - Power BI File Menu

The Options window will open. In the Options window, on the left you will see a column of settings under the Global heading. Select Preview features. In the Preview features window, check the box for Custom report themes. Power BI will then prompt you to restart the program. (Please note, custom report themes are a Preview Feature in Power BI at the time this article is being written, hopefully in the future this feature will be standard and will not require this step).

Figure 2 - Power BI Options Menu
Figure 2 - Power BI Options Menu

Once you restart Power BI, you will then have a new icon for Switch Theme on the Home tab. This icon will now be present on any Power BI file opened in Power BI desktop going forward.

Figure 3 - Power BI Switch Theme Menu Option
Figure 3 - Power BI Switch Theme Menu Option

  1. Create the Custom Color Theme

Next, you will need to create the file that has your selected brand colors. You will create a JSON (JavaScript Object Notation) file that provides Power BI with the basic information it needs to fill in your chosen colors. If you haven’t written code before or haven’t worked with JSON before, have no fear, for this customization you will simply follow a basic template. You can write the color theme JSON file in a standard code-writing program like Visual Studio if you have it, or you can write in Microsoft Notepad. The custom color theme allows for the customization of four items: the eight standard colors used in the report visualizations, the report background, the report foreground, and the standard color used for table visualizations.

You can copy and paste the following JSON into Notepad (or code editing software). The colors must be expressed in hex code preceded by the pound sign #. If you are unfamiliar with hex code for colors, there are many websites available to help you convert standard RBG color codes to hex. The only portions of this code you want to change are the name and hex colors.

{

      "name": "Example Theme",

      "dataColors": [

           "#CE2A23",

           "#262261",

           "#6D6E71",

           "#F5D33F",

           "#007100",

           "#F07F09",

           "#26BCC8",

           "#8431B4"

      ],

      "background": "#FFFFFF",

      "foreground": "#808080",

      "tableAccent": "#CE2A23"

}

Your color theme must have a name and you must have at least one data color. The background, foreground, and table accent are optional. I recommend listing up to eight data colors. If you list fewer than eight colors, Power BI will select default colors for the remaining un-customized color options. If you list more than eight colors, the other colors will show up on your visualizations, but will not show up on the manual color selection drop down.

To remove the optional portions, simply delete out that section of text. For example, if you want the background and foreground to be the default Power BI colors (Power BI default foreground and background are white, hex #FFFFFF) and do not want to specify the table accent, you would use JSON that does not list these optional items:

{

            "name": "Example Theme",

            "dataColors": [

                        "#CE2A23",

                        "#262261",

                        "#6D6E71",

                        "#F5D33F",

                        "#007100",       

                        "#F07F09",

                        "#26BCC8",

                        "#8431B4"

            ]

}

Once you have your JSON code written save the file as a .json. If using Notepad, click to save and then on the file name, change the extension from .txt to .json

Figure 4 - Saving JSON Code
Figure 4 - Saving JSON Code

  1. Using Custom Color Themes

Now that you have created your custom color theme using JSON, you need to import it into your Power BI report. The custom color themes work best when starting a new Power BI report. You can apply the theme to an existing report, but will then have to update manually any visualizations that already exist.

Open a new Power BI desktop file, select the new Switch Theme button on the Home tab. Select Import Theme, and use the file explorer to find the .json file you created for your theme. You will then get a pop up to let you know your theme was imported successfully. If you receive an error, go back and look at your JSON code and make sure you aren’t missing a comma or quotation marks or if there is some other error present.

Figure 5 - Power BI Import Theme Option
Figure 5 - Power BI Import Theme Option

Figure 6 - Import Successful Confirmation
Figure 6 - Import Successful Confirmation

Now when you create visualizations, the colors will default to those you created in the JSON file. When you manually go to change colors inside of a visualization, your color options will also show up as those you specified in the JSON file. If you have applied your theme to an existing report, you will still have to update the colors on each existing visualization manually, but the theme colors to select from will be those from your custom theme.

Figure 7 - Custom Color Theme in Power BI
Figure 7 - Custom Color Theme in Power BI

Now your report will have your standard brand colors and you can have consistency across your company reports.

Visit the Microsoft Power BI community for premade color themes.

If you would like to learn more about utilizing Power BI in your business and the power of interactive and dynamic reporting, please contact our business intelligence team today.

Read more "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV.

Blog Tags: 
Read ArcherPoint's Blog Follow us on Twitter Follow us on Facebook Follow us on LinkedIn Link to our RSS feed Join us on Google+ Watch us on YouTube
Get Help Now