I have a paper-dialog in my Polymer element. I want to make the backdrop opaque, right now it is semi-transparent. I would also like to change the color.
Does anyone know how to do it. I have already tried this css in my custom element:
<style is="custom-style">
--iron-overlay-backdrop-opacity:1;
</style>
<paper-dialog modal></paper-dialog>
But it had no effect.
I also tried
<style is="custom-style">
:host {
--iron-overlay-backdrop-opacity:1;
}
</style>
<paper-dialog modal></paper-dialog>
The
iron-overlay-backdrop
is appended directly to the document body, outside of your custom element, and due to Polymer's CSS encapsulation, you can't style the backdrop with a<style>
from within the element.However, your element could imperatively style the backdrop with
Polymer.updateStyles(...)
, which updates the styles for all custom elements, including theiron-overlay-backdrop
outside your element:codepen
Or to set a fixed static style for all backdrops, use
<style is="custom-style">
from the body:codepen