Forum Discussion

IBweroP's avatar
IBweroP
Regular Visitor
8 years ago

set background color scale in JSON for PowerBI Desktop - Custom Themes

Hi everyone

 

Can someone please advise the JSON code to set the background color scale in JSON as I would like to add this to our corporate color scheme JSON file?

 

The code needs to set the colors for Minimum, Center and Maximum for both Lowest Value and Number.

 

Thanks!

6 Replies

    • NickTrent32's avatar
      NickTrent32
      Icon for Advocate II rankAdvocate II

      The September 2019 Power BI Desktop update video had a spot that finally showed the correct syntax to do this!

       

      "maximum": "#00b050",
      "center": "#ffff00",
      "minimum": "#c00000",

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi IBweroP,

     

    What background color do you want to set in JSON file, Page or Visuals?

     

    If you want to set the background color of visuals, you could modify your JSON file. You could have a good reference of this article to know Report theme JSON file format.

     

    If you want to set the background of page in JSON file, this feature is not supported in Power BI currently, you could vote this similar idea here which has been submitted in Power BI ideas forum and add your comments there to improve Power BI and make this feature coming sooner.


     The code needs to set the colors for Minimum, Center and Maximum for both Lowest Value and Number.

    I'm not clear about what you mean, could you describe in more details?

     

    Best Regards,

    Cherry

    • IBweroP's avatar
      IBweroP
      Regular Visitor

      Hi Cherry v-piga-msft

       

      Thank you for your response and apologies for being slightly vague with my first post.

       

      In a Table visualisation, you can manually set the Background Color Style of a Values column** by

      1) Left mouse click select the desired Values field arrow you wish to apply the style to then

      2) Select Conditional Formatting then

      3) Select Background Color Style

       

      This then gets you to a screen where you select the color values for Minimum, Center (if Diverging is ticked) and Maximum Values for either Lowest Value or Number.

       

      This then shades the column values with various color shades which allows you to visually see which values are at the extreme ends of the scale and what values are somewhere in the middle.

       

      I would like to set the color scheme for the color scale in a Json file so that staff dont use non-company branded colors in their table graphics. i.e. the correct color scheme is already loaded for them and they dont have to think about "making it pretty" with non-branded colors.. We have created a Json file for many of the other Visuals but this one has us stumped on the exact Json code needed.

       

      **The functionality for a Background Color scale only works with columns that can sum to a total.

       

      Thanks for your interest in this problem.

      Much appreciated!

      • v-piga-msft's avatar
        v-piga-msft
        Icon for Resident Rockstar rankResident Rockstar

        Hi IBweroP,

         

        If I understand your requirement  correctly that you want to set the theme color in the JSON file that you could use it in your conditional formatting?

         

        Do you want to get theme color like below?

         

         

        If it is, you could have a reference of this JSON file.

         

        Reference:

        my test pbix file

        Report theme JSON file format

         

        Best Regards,

        Cherry