Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
SBusheyDewberry
Regular Visitor

Can we make exceptions to hex colors in dataColors for specific visuals?

Hello, I am new here, so I apologize if this isn;t in the right forum thread.

 

I am working on developing a corporate JSON theme. For the first level dataColors field at the top of the JSON file, I have put our 8 main branded colors:

 

"dataColors":[
"#77787B",
"#7B003F",
"#3D6DA8",
"#52B9E9",
"#FDBF63",
"#517891",
"#58595B",
"#D6A244",

 

However, when specifying for a visual like the line chart, I can pull the examples from Githubs like this: https://github.com/MattRudy/PowerBI-ThemeTemplates

 

Where I can see we can set a default color as defaultColor like such:
"dataPoint": [{
"defaultColor": { "solid": { "color": "#3D6DA8"}}

}]

SBusheyDewberry_0-1659100184725.png

(Ignore the neon green, it is for testing other hex values)

 

Because we don't want to use the top-level grey #77787B and berry #7B003F for a lot of the data, but it is useful for things like text boxes and KPIs to have at the front of the color picker in BI. So when we produce line charts, bar graphs, or really any data, we want to start automatically with the 3rd color, the blue at #3D6DA8.

 

When I apply a secondary y-axis though, it also defaults to the blue #3D6DA8.

SBusheyDewberry_1-1659100238977.png

If I instead write dataPoint as:

 "dataPoint": [{
"defaultColor": { "solid": { "color": "dataColors"}}

SBusheyDewberry_2-1659100393079.png

I will get the secondary y-axis to automatically be a different color, but they are grey and berry, respectively.

 

Can I basically write a rule somehow in this JSON to say use the data colors, but not the first 2? Is there a way to do this in the JSON file?

 

I know manually formatting would be a lot easier, but we are trying to get this as automatic as possible and get it close to our brand standards that match other Microsoft products.

 

I am pretty inexperienced with coding, so I would appreciate any pointers, thanks!

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @SBusheyDewberry,

The 'datacolor' sets value will be used to assign colors to data bars of the chart that enabled the legends fields.
If you want to accurate setting specific visual styles, you can define the visual type in the theme file and set the properties.

Use report themes in Power BI Desktop - Power BI | Microsoft Docs

"visualStyles": {
        "<visualName>": {
            "<styleName>": {
                "<cardName>": [{
                    "<propertyName>": <propertyValue>
                }]
            }
        }
    }

Notice:

1. Some of the properties have not been released and you can't configure them in theme files.
2. The dynamic generated and expand parts may not able to be set in themes.

Regards,

Xiaoxin Sheng

View solution in original post

Hariharan_R
Solution Sage
Solution Sage

Hi @SBusheyDewberry 

You can't handle the JSON theme dyanmically. You need to manually edit and use it in the file. Dynamic option is only applicable on the visual formatting color option which again can't stored as dynamic result in JSON.

 

Thanks

Hari

Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


My Blog :: YouTube Channel :: My Linkedin


View solution in original post

2 REPLIES 2
Hariharan_R
Solution Sage
Solution Sage

Hi @SBusheyDewberry 

You can't handle the JSON theme dyanmically. You need to manually edit and use it in the file. Dynamic option is only applicable on the visual formatting color option which again can't stored as dynamic result in JSON.

 

Thanks

Hari

Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


My Blog :: YouTube Channel :: My Linkedin


Anonymous
Not applicable

Hi @SBusheyDewberry,

The 'datacolor' sets value will be used to assign colors to data bars of the chart that enabled the legends fields.
If you want to accurate setting specific visual styles, you can define the visual type in the theme file and set the properties.

Use report themes in Power BI Desktop - Power BI | Microsoft Docs

"visualStyles": {
        "<visualName>": {
            "<styleName>": {
                "<cardName>": [{
                    "<propertyName>": <propertyValue>
                }]
            }
        }
    }

Notice:

1. Some of the properties have not been released and you can't configure them in theme files.
2. The dynamic generated and expand parts may not able to be set in themes.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.