Borrowed from another site:
Dome light dimmer for Cars -designed by Naveen P N
This unique circuit makes your dome light look cool. Usually when the car door is closed, the dome light just goes OFF. With this circuit, you can have our dome light fade slowly in brightness and finally go OFF. This slow dimming of the light gives a very good feeling at night. It looks very romantic!
The circuit can be explained as follows: When the car door is open, the push to off switch of the door is ON and hence it charges the 22uF capacitor fully. The opamp is acting as a voltage follower and its output is same as the voltage across the capacitor, which is 12V when the capacitor is fully charged. Due to a high voltage at the output of the IC, the transistor saturates, turning ON the bulb to full brightness.
Now when the door is closed, the door switch is pushed in and hence the switch goes OFF. When the switch is OFF, the capacitor starts discharging slowly through VR1 and the 10K resistor and the voltage across it decreases slowly. Hence at the output of IC 741 also the voltage decreases gradually, hence decreasing the base current to the transistor. This produces a slowly decreasing current through the bulb and the bulb fades out and finally when the capacitor is fully discharged, the bulb goes OFF.
After building the circuit, with the push-to-off switch in ON position (not pushed in) i.e. the car door open, adjust the preset VR2 to the required initial brightness of the bulb. Then push the switch in to turn it OFF(or close the door) and adjust VR1 for the time to bring the bulb from full brightness to OFF.
I would suggest you set VR1 and VR2 to their maximum values.
Note: 2N3055 power transistor needs proper heat sink.
Click here for circuit diagram.