Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Set shape color in Theme .json

Hi community,

I'm in the process of building a PBI template for a customer. I've got an issue with the standard fill of shapes that I can't seem to get working. Here's the code that I'm using:

 

 

{
	"name": "ShapeTemplate",
	"visualStyles": {
		"shape": {
			"*": {
				
				"fill": [{
					"show": true,
					"fillColor": { "solid": { "color": "#FFFFFF"}},
					"transparency": 0
				}],
				"visualHeader": [{
					"show": false
				}]
			}
		},
		"page": {
			"*": {
				"background": [
					{
						"color": {
							"solid": {
								"color": "#CCCCCC"
							}
						},
						"transparency": 100
					}
				],
				"outspace": [
					{
						"color": {
							"solid": {
								"color": "#CCCCCC"
							}
						},
						"transparency": 0
					}
				]
			}
		}
	}
}

 

 

 

I've am able to show/hide the fill using the code above, but it seems like the 'fillColor' parameter does not work for me. Has anyone of you been able to get the fill color working in their templates? If so then I'm curious how you all did it.

 

kind regards

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Please try this code and test whether it will work.

    For referenec: https://github.com/deldersveld/PowerBI-ThemeTemplates/blob/master/Shape.json

    {
    	"name": "ShapeTemplate",
    	"visualStyles": {
    		"basicShape": {
    			"*": {
    				"line": [{
    					"lineColor": { "solid": { "color": "#01B8AA"}},
    					"transparency": 0,
    					"weight": 3,
    					"roundEdge": 0
    				}],
    				"fill": [{
    					"show": true,
    					"fillColor": { "solid": { "color": "#DDDDDD"}},
    					"transparency": 0
    				}],
    				"rotation": [{
    					"angle": 0
    				}],
    				"visualHeader": [{
    					"show": false
    				}]
    			}
    		}
    	}
    }

    And you can check the official document about power bi themes.  It listed all the properties: (notice: some of the properties can be confited but they not really enabeld to settings since power bi did not release them to GA for theme usage)

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

     

    Best Regards,
    Rico Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Please try this code and test whether it will work.

    For referenec: https://github.com/deldersveld/PowerBI-ThemeTemplates/blob/master/Shape.json

    {
    	"name": "ShapeTemplate",
    	"visualStyles": {
    		"basicShape": {
    			"*": {
    				"line": [{
    					"lineColor": { "solid": { "color": "#01B8AA"}},
    					"transparency": 0,
    					"weight": 3,
    					"roundEdge": 0
    				}],
    				"fill": [{
    					"show": true,
    					"fillColor": { "solid": { "color": "#DDDDDD"}},
    					"transparency": 0
    				}],
    				"rotation": [{
    					"angle": 0
    				}],
    				"visualHeader": [{
    					"show": false
    				}]
    			}
    		}
    	}
    }

    And you can check the official document about power bi themes.  It listed all the properties: (notice: some of the properties can be confited but they not really enabeld to settings since power bi did not release them to GA for theme usage)

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

     

    Best Regards,
    Rico Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.