How do I make my dome light fade away when you shut the door?

Maybe a properly rated capacitor in series with the light

Parallel, not in series. Positive side to lamp lead and negative side to ground. A capacitor will only pass ac, it will store DC.