Reputation: 4668
This snippet I used to change the style of an fab element before:
<style is="custom-style">
:root {
--paper-fab-background: #42a9f7 !important;
}
</style>
But how can I change the color using javascript?
Upvotes: 1
Views: 167
Reputation: 1827
this.$.paperfab.updateStyles({ '--paper-fab-background': '#42a9f7' });
With paperfab being the id of your paper-fab element placed in a function, of course.
Upvotes: 1
Reputation: 2037
Change color of an element via JavaScript:
Change element color:
document.getElementById(elementID).style.color = "#42a9f7"
;
Multiple styles on element:
document.getElementById(elementID).style.cssText = "color:#42a9f7;background:red"
;
Upvotes: 0
Reputation: 111
Its Easy First set an Id to the html element whose color you want to change then use document.getElementById(elementID).style.backgroundColor = #42a9f7 !important; Thats It
Upvotes: 0