This content originally appeared on Hussein Al Hammad and was authored by Hussein Al Hammad
Fontawesome added duotone support back in July 2019. So this is a little overdue, but better late than never! You can now use FontAwesomeSVG-PHP v1.2 to output Fontawesome duotone SVG icons with PHP (no JS required).
Output a duoetone icon in single colour:
echo $FA->get_svg('fad fa-laugh-wink', [
'fill' => '#e64980',
]);
Swap layer opacity by adding the fa-swap-opacity
class:
echo $FA->get_svg('fad fa-laugh-wink', [
'fill' => '#e64980',
'class' => 'fa-swap-opacity',
]);
Single colour with custom opacity:
echo $FA->get_svg('fad fa-laugh-wink', [
'fill' => '#e64980',
'secondary' => [
'opacity' => '0.2',
],
]);
Custom colours and opacity:
echo $FA->get_svg('fad fa-laugh-wink', [
'primary' => [
'fill' => '#e64980',
'opacity' => '0.5',
],
'secondary' => [
'fill' => '#fcc417',
'opacity' => '1',
],
]);
Head to the GitHub repo to learn more.
This content originally appeared on Hussein Al Hammad and was authored by Hussein Al Hammad

Hussein Al Hammad | Sciencx (2020-06-26T00:00:00+00:00) FontAwesomeSVG-PHP v1.2: Duetone support. Retrieved from https://www.scien.cx/2020/06/26/fontawesomesvg-php-v1-2-duetone-support/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.