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
Anonymous
Not applicable

Custom color formatting based on themes in PowerBI Desktop

Hi 

 

Does anyone have a clue to fetch the color formatting picker color based on theme change?

 

We have a custom color formatting option to change the particular div background in our custom visual, by default the PowerBI document .pbix file having a default theme while fetching the color from picker it retrieved proper solid color. 

 

But after changing the premade theme of PowerBI like electric, it not retrieve the proper color code. It retrieves only the solid Theme color 9.

 

capabilities.json configuration


"background": {
"displayName": "Background Color",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
}
 
Formatting value fetching by,
 
let backgroundProperty: DataViewObjectPropertyIdentifier = {
objectName: objectName,
propertyName: "background"
};
var background = DataViewObjects.getValue<object>(objects, backgroundProperty, { "solid": { "color": "#FFFFFF" } });

 

Screenshot_1.pngScreenshot_2.png

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may take a look at the following posts.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Yes, the theme colors are updated based on the selected theme, but while fetching the color code through the custom visual with the below-mentioned config of capabilities.json it retrieved only the solid(default theme) color code.

 

e.g, after changed the theme, the selected color is #F64F5C but in visual it retrieved the color code only from the default theme color palette - #FE9666

 

"background": {
"displayName": "Background Color",
"type": {
"fill": {
"solid": {
"color": true
}
}
}
}

I am facing the exact same problem. Did you ever manage to find a solution for this. In my format pane, when i want to choose a color for my barplot it shows the correct color for the current theme, but it gives the hex color code for the classic theme. So if I select Theme color 1 for my current theme, so square which I click on is the correct color, but when it loads on to my custom visual it uses Theme color 1 from the "classic" power BI theme no matter what theme i select.

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.