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
Matt SchetselaarMatt Schetselaar 

Conditionally change link color in lightning component

Has anyone successfully changed the color of a link in a Lightning Component based on some attribute on the Component?  I can change the link color all the time but not conditionally.
Khan AnasKhan Anas (Salesforce Developers) 
Hi Matt,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

https://salesforce.stackexchange.com/questions/169671/conditional-coloring-on-a-lightning-component

https://salesforce.stackexchange.com/questions/244019/apply-a-css-class-depending-on-the-value-of-the-auraattribute-in-a-lightning-co

https://salesforce.stackexchange.com/questions/244699/change-cell-text-color-based-on-cell-value-in-lightningdatatable

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Ajay K DubediAjay K Dubedi
Hi Matt,

For change link color on hover condition in lightning component use below code
<a class="link" href="javascript:void(0)" onclick="{!c.doSomething}">
            Click me to do Something 
</a>

.link {
  color: #FFF;
}
.link:hover {
   color: #00F
}

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
www.ajaydubedi.com