At night, a black background with a faint red foreground is ideal: one extra advantage of this "submarine mode" is the lack of blue light, to avoid disturbing sleep
Dark gray is acceptable as a proxy for the black background only if you don't have an OLED display (or if you're not in a dark room)
Some people with vision problems report that white on black cause visual artefacts for them, but it's often because they use a brightness that's too high