function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Karthik jKarthik j 

How to give a colour to the utility icon used in lightning card

Hi All

I have used one utility icon for the icon-name attribute of lightning-card.

<lightning-card title="Account GMV" icon-name="utility:table"></lightning-card>

By default the utility icon will be displayed with no colour. Now I want to give a colour to it.

I tried add a CSS class inside the tag and write css code to give colur. That didn't work.
<lightning-card title="Account GMV" class ="greenClour" icon-name="utility:table"></lightning-card>

.THIS.greenClour svg{
      fill: #7FFF00;
}


It didn't work. Can anyone please help me to achieve this?
AnkaiahAnkaiah (Salesforce Developers) 
Hi Karthik,

Refer the below link will help you to proceed further.
https://developer.salesforce.com/docs/component-library/bundle/lightning-icon/documentation
https://salesforce.stackexchange.com/questions/147153/lightning-icon-color-is-not-changing-using-the-fill-css

Thanks!!
CharuDuttCharuDutt
Hi Karthik
Try Below Css It Will Work For Every Icon And Will Change Colour
*{
    --lwc-colorTextIconDefault: #F62217;
}
Please Mark It As Best Answer If It Helps
Thank You!