Bottom note box.
Looking at the positive side of things even when difficult times are present.

This phrase is often said to people who are feeling down or depressed in
an attempt to try and cheer them up.
This saying seems to come from the way clouds look every so often. Sometimes, clouds will have a dark appearance to them. Such clouds might even be described as looking 'gloomy.' However, if you look closely at the clouds during this time, you may be able to see the sun shining behind them, which can give the lining of a cloud a silvery colored look; basically, the edges of a dark cloud might look lighter than the rest of the cloud. So, the idea for this phrase is that when things are looking dreary, there's always a brighter side; the comparison looks to be drawn from how dark clouds have a brighter side to them: their 'silver linings.'

Anyhow, this idiom goes back to at least the first half of the 19th century, as it is used in The Atlas newspaper, printed in the 1840s:

"The good nurse's consolatory proverb is agreeably borne out, that there is never a cloud without a
silver lining."

The modern wording of the phrase that people are familiar with today is written in a book by P.T. Barnum, 1869, where he wrote:

"'Every cloud,' says the proverb, 'has a silver lining,' and so I did not despair.'"
Common Phrase Origins and Meanings > E-Letter Idioms
Note: When it comes to seeking the phrase origins of certain idioms, finding the exact time an expression orginated is not a piece of cake. By and large, what's provide are moments in history where a saying really starts to be used in a common manner. For example, the majority of sayings can be found in old newspapers from several decades or even more than a century ago, but let's think about that. If an idiom is being used in a form of media like a newspaper, then everybody already knows about it! Meaning the saying's origins are likely much older.

On that note, what you'll see here is basically an early written form of the particular phrase, typically coming from an old book, play, poem, or newspaper. It's meant to give you a rough estimate on how long ago the phrase has been in use for, but may not be precisely where it originated. - Meanings and Origins of Phrases
* Sarah, even though you lost the race, every cloud has a silver lining. This race helped to motivate you to lose some weight and get back into shape.
Meaning for the phrase Every cloud has a silver lining.
Origins for the idiom Every Cloud has a Silver Lining.
The Letter E - Phrases starting with the letter E.
Phrases and Idioms