Puritan society's definition of "sun" affects the individual within society by making him or her think that God's favor is upon them.
What complicates this understanding is the fact that the sunshine falls upon Hester Prynne despite her having been condemned and ostracized as a so-called fallen woman, a sinful temptress who doesn't belong in decent society among God-fearing people.
Sun shines on the righteous, as they say, but there's nothing remotely righteous about Hester from the point of view of Puritan society. And yet, in chapter 18, when she finally casts off the scarlet letter, the sun shines upon her, casting her in a truly radiant glow.
Whatever the judgmental Puritans may think, Nature appears to smile on Hester. And if one regards the sunshine, as with all aspects of Nature, as a reflection of God, then it is difficult to conclude that the Almighty regards Hester in the same way as the citizens of Puritan Boston.