Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the background color of an iron-icon in Polymer?

I want to change the search iron-icon's background-color to blue. I tried adding a style attribute and setting the background-color: blue but that didn't work. All help is greatly appreciated.

<iron-icon icon="icons:search" on-click="doSomething" hidden$="{{disabled}}"></iron-icon>
like image 301
user3225968 Avatar asked Dec 05 '22 02:12

user3225968


2 Answers

You just need to update the fill in css. The default value is currentColor which will match your text color.

<iron-icon icon="icons:search" on-click="doSomething" hidden$="{{disabled}}" 
    style="fill:blue">
</iron-icon>
like image 184
Justin XL Avatar answered Mar 09 '23 00:03

Justin XL


<iron-icon icon="icons:search" on-click="doSimpleSearch" hidden$="{{disabled}}" class="searchIcon"></iron-icon>

.searchIcon {
            fill: #ffffff;
            *background-color: #3BC2E6;*
            height: 38px;
            width: 60px;
            border-radius: 5px;
        }
like image 28
user3225968 Avatar answered Mar 09 '23 00:03

user3225968