She walks into a room you’re using and turns the lights off? For me the issue wouldn’t be that she’s turning out the lights. It would be that she’s turning them off while you’re clearly using them.
My spouse is an electrician. The type of lighting can make a huge difference in the quality and quantity of light. There are spaces where I could work with just a good lamp and others that would require additional light from a ceiling fixture. Working without the additional light would cause eye strain and possibly trigger a migraine.
I wouldn’t ask your roommate for permission to turn the lights back on, especially if she’s not asking you for permission to turn them off. And I wouldn’t leave either. I would politely ask why she turns them off while you’re using them. It’s probably just a habit. Then turn them back on so you can see what you’re doing.