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

I'm trying to understand what purpose this would serve other than to look cool. I mean, when I shut the car door, I don't look back.