Can the federal solar tax credit offset capital gains incurred?

I want to sell a few long-term held stocks this year that will result in capital gains. I also purchased and installed a new solar array for my home (not a rental property). Can I use the federal solar credit to offset the capital gains tax?