Here is a script that does what you requested.
;Artificial Intelligence Script
;Header
desc = N for green
;Triggers
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecore\text\lockeddoor.tga,hudname=ndisplay,hudhide=1,hudmake=display,state=1
:state=1:ambiencered=225,ambiencegreen=225,ambienceblue=225,hudunshow=ndisplay,state=2
:state=2,scancodekeypressed=0:state=3
:state=3,scancodekeypressed=49:state=4
:state=4:ambiencered=0,ambiencegreen=255,ambienceblue=0,hudshow=ndisplay,state=5
:state=5,scancodekeypressed=0:state=6
:state=6,scancodekeypressed=49:state=1
;End of Script
Of course, you need to change the hud to whatever you want as well as relocate it on the screen. (state=0)
You also need to place an entity in your map, set its STATIC MODE to NO, and set it's Main AI to this script.
You might ask "why do you have state 2 and state 5 doing a scancodekeypressed=0?"
The answer is because you are using the same key to toggle, and if you didn't check for the key release then it would malfunction.
If you want to go from dark to light then add AMBIENCE=X where X is a value between 0 and 100. (not 0-255 like ambience colors)
This should be enough to get you started.
I hope this helps.