This phrase was authored by John Milton in his 1634 work Comus: A Mask Presented at Ludlow Castle.
I see ye visibly, and now believe
That he, the Supreme Good, to whom all things ill
Are but as slavish officers of vengeance,
Would send a glistering guardian, if need were
To keep my life and honour unassailed.
Was I deceived, or did a sable cloud
Turn forth her silver lining on the night?
I did not err; there does a sable cloud
Turn forth her silver lining on the night,
And casts a gleam over this tufted grove.
The phrase morphed throughout the years to the one we use today. Read about its evolution here.
One afternoon I was driving and spotted the silver lining.
So I had to stop and capture it!