At a deeper level. the fact that you are outside looking at a sunset means that it is part of you; therefore, your mood not only colors the sunset, it creates it. That is, when you are depressed, you aren't looking at something beautiful and glorious without the ability to appreciate it: the sunset is depressing; for you, in this moment, it has no other way of being.
Could I understand the above like the following: "when you are depressed, it is hard to see some beautiful scene like sunset as beautiful and glorious. You have to have the ability to appreciate it to see it as beautiful and glorious especially when you are depressed"?
Here the author is referring to different moods of people. You see when we are happy, we like seeing things colorful and beautiful, whereas its the opposite when you are sad or depressed. Such is when a person is sad and he is sitting quietly observing the sun's light die - which shows his psychological state that he is deppressed. So, further in your lines ''You have to have the ability to appreciate it to see it as beautiful and glorious especially when you are depressed'', the author says that a person must be strong enough and should learn to control his emotions. And if you develop that quality of doing things against your mood such as appreciating something in a nice way when you are sad, it will make you feel better and get over your sorrow!
ps i'm not a teacher, thats what it looks like to me.