Solar stocks have taken a beating over the past year, and the slump has continued in 2017, with many top companies off by 50% or more in the past 12 months. That's a tough pill to swallow for investors who have watched solar stocks soar in the past due in part to federal tax credits for home solar installation and other incentives to stimulate the industry. (See also: Are Solar Stocks Set for a Rebound?)

A number of factors are behind the rapid decline – a sharp decrease in demand from China, lowered Japanese tariffs and the expected expiration of the tax credits at the end of last year (which were ultimately extended to 2021). Right now, there's a glut of solar panels driving prices down. (See also: A Look at Solar Energy Earnings.)

However, the facts on the ground suggest that solar's fortunes may improve over the medium and long term. Consider that solar energy use is skyrocketing – nearly 40% of all new energy installations in 2016 were solar. The solar workforce has tripled since 2010, reaching some 270,000 workers currently, edging out the number employed in natural gas and nearly doubling the number employed by coal. Of course, there's uncertainty under the Trump administration, which may not pursue the aggressive alternative energy policies of the previous administration. (See also: 2017: A Turning Point for the Solar Industry.)

That said, depending on your point of view, depressed stock prices may mean that the time is right to jump into solar. If you're considering solar exposure for your portfolio, here are the top picks for 2017. Note: All figures are current as of August 4, 2017.

First Solar, Inc. (FSLR)

After a somewhat disappointing 2016, when revenue was down nearly 20% from 2015, First Solar is off to a great start in 2017. After a great first quarter revenue report of $891 million, second quarter revenue came in at $623.3 million, well above consensus estimates of $556 million, but down 33% from the same period in 2016. Earnings per share for 2016 came in at $5.17, also beating estimates by about 10%.

Currently, the stock is trading at about $48, up 10% for the year. First Solar stock is close to its 12-month price target of $52; the stock saw its consensus rating improve from Hold to Outperform on June 7 this year. First Solar has a market cap of $5 billion, and recent guidance suggests that it will have about $1.5 billion in net cash on the balance sheet by the end of 2017, a reassuring figure. (See also: Is First Solar a Great Deal or a Trap?)

SunPower Corporation (SPWR)

SunPower lost more than one-third of its value over the past year, a figure that strikes fear in the heart of the average investor. Bankruptcy is a definite concern with some solar companies, but SunPower is majority owned (66%) by petroleum giant Total S.A. (TOT), which is propping it up with credit and even purchasing solar panels for its 5,000 gas stations. SunPower is plowing money into new technology from Congenra Solar to boost its solar panels' efficiency and move into utility-scale projects, which could be a game changer for the balance sheet.

SunPower has a market cap of $1.3 billion, and it reported revenue last year of $2.56 billion, up 62%. However, income was down markedly – the company reported a loss of $471 million in 2016. The stock is currently trading at about $9.25 per share, 10% below its 12-month price target. Second quarter revenue of $341.5 million beat analysts' expectations but was down 15% from 2Q 2016. (See also: Will the Sun Shine Again on SunPower?)

Vivint Solar, Inc. (VSLR)

Vivint is a residential solar company that provides both rooftop solar and storage solutions. The stock had a bang-up month in June, rallying over 80% after Goldman Sachs analysts upgraded the stock to a Buy and nearly doubled their price target from $3.50 to $6.00 per share. The stock is currently trading at $5.05 per share, near its 52-week high of $6.09 and up over 81% for the year.

Numbers like that could give investors pause, but the company's recent move to a cash and loan sales model and its national footprint could make it an attractive acquisition target. Plus, Vivint Solar has some of the lowest solar installation costs in the country. Pending legislation in Nevada, which will allow solar owners to sell excess electricity to the utility companies at 95% of retail prices, could mean a huge revenue boost for Vivint if it restarts operations in the state.

First quarter revenue of $53 million was up over 200% over the same period last year, and 2016 total revenue of $135 million was up over 110% from 2015. (See also: Solar Stocks Boom on Trump's 'Solar Wall'.)

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.