June 26, 2020
FontAwesomeSVG-PHP v1.2: Duetone support
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.