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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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


v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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