In this idiom the cloud is negative and dark and you don't want it to be there, but the edge of the cloud is bright and pretty and positive (picture a lone dark cloud with the sun directly behind it so that the edges are lit up).
The saying is meant to remind us that even when bad things happen there is still something positive that you can focus on instead.
Maybe you have to be in the hospital, and that is sad, but all your friends and family come to visit you and you see how much love they have for you! Every cloud has a silver lining.