It's the latter, Roland, but the issue is that it also happens when you're just in a partially enclosed space. I remember faatal saying something about the lighting changing when the game "considers" if you're inside or not. That part works ok for rain, but not so much for lighting, since you only need to be surrounded by a few blocks (and one on top of your head) to trigger the "dark mode".
In the end, I think it's just a question of refining the current way or create a new, separate one, specifically for the lighting part.