I agree that this is hard to read, primarily because he is sprinkling commas in places they clearly do not belong under modern rules of grammar. Let's just take this sentence by sentence:
It has been observed, in treating of the passions, that men are mightily governed by the imagination, and proportion their affections more to the light, under which any object appears to them, than to its real and intrinsic value.
My rough translation: I noticed that people care more about how things look than about what they are.
What strikes upon them with a strong and lively idea commonly prevails above what lies in a more obscure light; and it must be a great superiority of value, that is able to compensate this advantage.
People are too superficial, and will only notice subtle properties of objects if those properties are valuable or useful in some way.
Now as every thing, that is contiguous to us, either in space or time, strikes upon us with such an idea, it has a proportional effect on the will and passions, and commonly operates with more force than any object, that lies in a more distant and obscure light.
Superficial properties have a tendency to inflame emotions in a way that subtle properties do not.
So to answer your question, "it" is here referring to the superficial features of an object that people will readily notice and comprehend. More precisely, the antecedent of the pronoun "it" is the phrase "such an idea," which refers back to the earlier phrase "What strikes upon them with a strong and lively idea..."
(Alternatively, the antecedent is "every thing," which is then restricted by the subsequent clauses so that it's clear we're talking about a "thing" with superficial properties that have an emotional effect etcetera. The grammar is so unclear that I'm uncertain which exact parse Hume intended. But either way, it has the same overall meaning.)