I am currently using Vue version 3.2.1 and have followed the official Font Awesome documentation for Vue 3 found at https://github.com/FortAwesome/vue-fontawesome. I also referenced a helpful video tutorial:
https://www.youtube.com/watch?v=MoDIpTuRWfM
Despite my efforts, I am struggling to change the color of the icons. Interestingly, I have been able to modify the background color (as seen with the up arrow in the screenshot) and adjust the opacity (as demonstrated by the baby carriage icon in the screenshot).
Below is the snippet of my code:
Main.js:
// BEGIN font awesome icons, following https://github.com/FortAwesome/vue-fontawesome
import { library } from '@fortawesome/fontawesome-svg-core'
import { FontAwesomeIcon, fontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { fab } from '@fortawesome/free-brands-svg-icons'
import { far } from '@fortawesome/free-regular-svg-icons'
import { dom } from '@fortawesome/fontawesome-svg-core'
dom.watch()
library.add(fas, fab, far)
// END font awesome icons
And ReviewDetails.vue, where I've explored various attempts:
<div>
<div style="color:red">
<fa icon="broom" size="lg"/>
</div>
<fa icon="star" size="lg" style="color: var(--warning)" />
<span style="color: var(--warning)"> <fa :icon="['fas', 'question']" fill="color:red" size="lg"/></span>
<fa icon="arrow-up" size="lg" style="background:MistyRose" />
<fa icon="heart" style="color: var(--warning)" size="lg" />
<fa icon="bone" style="color:#E1FF00" size="lg"/>
<fa icon="arrow-alt-circle-down" style="fill:#E1FF00" size="lg"/>
<fa icon="bomb" fill="#E1FF00" size="lg"/>
<fa icon="baby-carriage" size="lg" style="opacity: 0.2; color: rgb(222, 226, 230)"/>
<fa :icon="['far', 'star']" size="lg" style="color: #E1FF00" />
</div>
Attached is a screenshot displaying the output of the above code:
https://i.sstatic.net/AEDz5.png
In addition, no specific local or global CSS rules have been applied to target the icons directly. [UPDATE] Upon inspecting in the browser, it appears that the color is being controlled by the following styles in main.css (if I alter color: var(--primary);
below to something like color: rgb(242, 114, 12);
, the color of the icons and most text updates accordingly):
/* variables */
:root {
--primary: rgb(33, 37, 41);
--secondary: rgb(28, 117, 188);
--warning: #da0f41;
}
* {
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
color: var(--primary);
line-height: 1.40;
font-size: 1.07rem;
}
UPDATE: I have tested all potential solutions across Firefox, Safari, and Chrome browsers with consistent results.
Thank you!