André Kuhlmann
André Kuhlmann

Reputation: 4668

Change paper-fab color using javascript

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

Answers (3)

Patrick Knott
Patrick Knott

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

Yonatan Ayalon
Yonatan Ayalon

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

Abhinav rawat
Abhinav rawat

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

Related Questions