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:
1echo $FA->get_svg('fad fa-laugh-wink', [2 'fill' => '#e64980',3]);
Swap layer opacity by adding the fa-swap-opacity
class:
1echo $FA->get_svg('fad fa-laugh-wink', [2 'fill' => '#e64980',3 'class' => 'fa-swap-opacity',4]);
Single colour with custom opacity:
1echo $FA->get_svg('fad fa-laugh-wink', [2 'fill' => '#e64980',3 'secondary' => [4 'opacity' => '0.2',5 ],6]);
Custom colours and opacity:
1echo $FA->get_svg('fad fa-laugh-wink', [ 2 'primary' => [ 3 'fill' => '#e64980', 4 'opacity' => '0.5', 5 ], 6 'secondary' => [ 7 'fill' => '#fcc417', 8 'opacity' => '1', 9 ],10]);
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-2/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.