I’m also old enough to recognise the current fashion trend for dark mode is exactly that - a current fashion trend. They come and go all the time in every area and can be ignored if they don’t work for you.
If you’re more productive in light mode stick with it, stop worrying, and ignore the sheep who say dark mode is better. You can churn out code while they fiddle with their IDE settings to optimise the latest productivity hack.
Dark mode allows your iris to expand, which makes natural optical focus harder to achieve.
With more light, the iris contracts (small pupils) and the light that comes though it is naturally in focus on your retina without muscular help.
In a dark room, with the screen is at a short distance from you, your eye muscles have to squeeze your cornea into the right shape to put the image into focus on your retina.
And the older you get, the more inflexible your retina becomes, and your eye muscles are trying to squeeze a stone.
In either case, reading glasses can help if they are properly adjusted to the distance from your eyes to your screen. the amount of squeezing on the cornea is eliminated (or minimized)
If you are using something closer, like an ipad or phone, you might need higher power reading glasses.
I use +0.75 for my computer screen and +1.25 for something held closer like an ipad.
Oh to be young again! When I was a kid I could focus at infinity AND focus on my fingerprint when my finger was held at the end of my nose.
For me, the best is to have dark text on a light enough background, enough screen brightness overall, and a well lit room (natural light is really good, as long as it isn't coming from behind me).