Set the background color of a Power BI Embedded IFrame

Posted on 01 June 2018

When the IFrame size that's allocated for an embedded object and the embedded object itself don't share the same aspect ratio, the result is gray margins on the sides (marked in red in the following figure).

Grey Shoulders

You can use the Custom Layout API to define how to fill the IFrame or set a fixed size for the object at any time. But that sometimes doesn't entirely fix the appearance of the gray margins.

You can now set the background color of the IFrame by making it transparent. By doing so, you'll give the IFrame the defined color of the DIV element that contains the IFrame. You have full control of what color/background layout will be seen in the margins, making the embedded object wrapped entirely by the application design.

Note that the default color is still gray, so you'll need to set a definition in the JavaScript code to get the transparency of the IFrame.

Related feedback