cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alexandarIX Regular Visitor
Regular Visitor

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

2 REPLIES 2
Community Support Team
Community Support Team

Re: Custom color formatting based on themes in PowerBI Desktop

@alexandarIX,

 

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.
alexandarIX Regular Visitor
Regular Visitor

Re: Custom color formatting based on themes in PowerBI Desktop

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
}
}
}
}