Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Can't focus when writing code in dark mode
46 points by vucetica 11 months ago | hide | past | favorite | 52 comments
Seeing fellow programmers left and right switching to dark mode and everyone seems very happy. I gave it a try a few times but it just doesn't work. I can't focus.

It is not the time that I need to get used to a different syntax highlighting scheme because I switch between editors all the time. I'm perfectly fine as long as the background is lighter than the foreground, so it has to do something with the dark mode itself.

Is it that I have to give it more time (so I can stop noticing that "something is wrong"), or simply it doesn't work for some people? And if so, what am I losing (reduced eye fatigue, better sleep...)?




The more light that hits your eyes, the more your iris contracts. The smaller hole makes for a clearer image (think of a pinhole camera). People who like dark mode have good vision at screen distance. For some others, they need to strain their eyes more to focus at that distance.

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).


I can’t agree with this more. I’m a 52 year old coder with older eyes and light mode with decent background lighting works much better for me than any other option.

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.


this is exactly it.

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.


I’m not sure there would be significant contraction at normal screen FOVs and brightness levels. Instead I think when your eye is out of focus the white smeared onto a black background is a much stronger signal than black smeared on a white background, due to visual perception’s inherent gamma curve exaggerating small brightness differences much more against low brightness levels (black background) than against high brightness levels (white background). So there is a much stronger perception of blurriness (black background with a +0.X lumen splotchy patch is exponentially more noticeable than a white background with a -0.X splotchy patch).


Most dark modes hurt my eyes, it seems like white characters or graphics on a black background burn my retina (like a glare). For video editing, photoshoping or any apps I use normal `white` mode. For coding I use solarized liked theme with pastels and soft colours.

It could be debated but I think it's a matter of personal taste, habits, personal sensitivity to light and scientific-based explanations and that each of those aspects carry a different weight depending on the person.


+1 for solarized theme. IDE solarized are better than dark mode. Most of the dark modes are actually hurting the eyes. Heavy contrast and font blur is very common thing in dark mode.



I’m also a long time solarized fan. I try new themes once in a while, but always return to good old Solarized Light.


I’m a huge Light Mode guy. I use the morning color scheme in vim, and the light schemes in VS and VSCode.

I do run f.lux, static at 49k... but I have found that dark editor schemes make me feel claustrophobic (!).

Everyone’s different! It just might not work for people like you or I, and that’s okay. :)


Exactly the feeling that I have (claustrophobic).


I started as a developer in the 80s on vt100 terminals with green and amber on black screens. I vividly remember how nice it was to switch to a light background without flicker and have never looked back. Choose what works for you.


I had VT100s in university and it was all green or amber monitors until Windows 3.0. It was a relief to the eyes to have something that looked like regular print on white paper. I find the default colors of dark mode syntax highlighting distractingly bright. The colors against white (or rather, light grey) seem less contrasty.


Amber monitors on a Hercules video card was supercrisp and easy on the eyes, but it was probably my young vision. Nowadays I also code better on white backgrounds, although I still prefer the console with black background.


I have my IDE and terminal themes following OSX Dark Mode, which I switch in and out of throughout the day depending on ambient lighting. My screen is perpendicular to the window, but still there's a period in the afternoon where it's almost impossible to read dark mode text.

At first I couldn't find a way to automate this and was doing it manually, but there are plugins for both iTerm [0] and IDEA [1].

Think of it as an adaptation for working in a dark environment, not something you use all the time.

[0] https://iterm2.com/python-api/examples/theme.html

[1] https://plugins.jetbrains.com/plugin/12515-dark-mode-sync


It seems most of us develop astigmatisms from using our screens less than an hour, particularly when at a 40 dev angle (like a laptop, phone) [1] and despite being temporary (mins, hours, days) the astigmatisms themselves vary in angles and wavelengths (read dark text, light text) effected from person to person. All of this adds up to no one person having the same level of strain from the same colors/brightness, and then compounded by it constantly changing and shifting with eye strain. For example, one of my eyes has trouble focusing on dark blue on bright white as the day progresses, the other eye hates red on black.

[1] https://eyewiki.aao.org/Physiology_of_Astigmatism


Dark vs Light mode seems to be the next Vim vs Emacs religious war. I'm on the Dark side.

I've not only got all my IDEs in dark mode, all my browser apps use stylus to darken things if the app doesn't already have it, and my MacOS is set to be permanently dark. And naturally my terminal window as well, and my mobile apps on all devices.

I simply find the strain on my eyes is a lot less. Particularly at night if I feel I need to reply to a message or use the laptop for whatever reason, it doesn't make my eyes hurt to open it. Before my dark mode revelation it would actually make me have to close my eyes.

Aethetically it makes sense too. With dark your laptop stops being a massive source of light, it's more of an everyday object that fits in any lighting.


I've always preferred light-on-dark. I have my Emacs background set to #000060, with primary foreground #88FF88. Very soothing.


Until this month, I was thinking that I like dark mode better, but then I started experiencing vertigo, nausea and all sorts of migraines after long programming sessions. I tried light mode and it went away. So light mode all the way for me!


It depends on the environment I am in. If I am in a dark room (my coworkers like the dark for some reason) it is much less glaring to look at a dark screen. In a well lit room (like my home office) a light theme is much easier to use. I just switch between the Tomorrow and Tomorrow Night themes.

https://github.com/ChrisKempson/Tomorrow-Theme


I wouldn't say it depends so much on the brightness of the room but rather the general brightness of the screen and if there is any sort of glare on it. I use dark mode always and switch to light mode when im sitting in a sunny area.

Dark mode has one distinct advantage: colors pop way more meaning the syntax highlighting is more pronounced, which makes it easier to navigate the code.


Dark mode appeals to some people and not others. Having things available only in dark mode would be just as bad as only in light mode. (Having things only available in system colors, and having that have many well tested color schemes would be most preferable, but since it's not 1995, I guess that's not going to happen)

If you want the least eye fatigue, you gotta go with yellow on blue, like Word Perfect of old. It's all about compromises.


Additionally some dark modes are just bad. I've got a couple of programs that I can only stand on light mode.


I wonder if this has to do with getting less blue light. After I started using flux I found myself getting exhausted and unable to focus after around 3-4pm especially in the winter. Bumping flux back to only after work made a huge, noticeable difference for me. Might be a similar effect with bright vs. dark screen.


started using and learning linux from the console so there was always a nostalgic reason for me to have everything in solarized dark. the last 2 or so years my eye sight has dropped due to aging but also because of way too much time on a screen. I notice it especially during reading ebooks at night that a dark theme isn't doing me favors so switched to an e-paper like color and slightly reduced screen brightness for late night pdfs/ebooks reading. (redshift does nothing for me here). an epaper color is a lot easier on my eyes than dark mode. still use dark colors for terminals during my day work but am also considering changing this but maybe it's because my eyes aren't tired throughout the day as much as they're between 21:00 and 02:00 ...


I hate dark mode, I thought I was weird. Glad to know there are others who prefer light mode!


Honestly I also find that I can more easily focus on light mode text when I'm well rested. Dark mode for me mostly reduces fatigue over time, preventing the ghosting after-image that my eyes do if they stare at a white background too long.

If dark mode isn't your cup of tea, you might try just decreasing the contrast of your light background or lowering the brightness on your monitor to get the same benefit. But really, your eyes are yours. If your setup works and doesn't seem to be causing you eye strain? Use that! No problem at all.


I used to use dark mode but for a few years now I strongly prefer light mode. For Vim and Vscode I use the papercolor (papercolor redux for vscode) theme and on Emacs I use the hemisu-light theme. Both of them are great.

I still use most terminals in dark mode because I dislike their light color themes.

I guess the essence is that I prefer light themes if they are really good (for me). In the end this is all subjective and you should just choose by comparing themes yourself and not because others use "some theme".


Use what works for you. Personally I frequently switch between the two as I find that light mode works better in the day for me, while dark mode is better in the evenings/night.


White text on black is as bad as black text on white for me; But I find off black (12/16/33) background and off-white (248/248/248) text significantly reduces eye-strain, for me at least.

If any of you are anywhere near 40 and feeling eye strain; you might be starting to suffer from presbyopia as i and most do at that age, getting a larger monitor and placing it slightly further away helps a lot more than any theme changes.


Dark mode hurts my eyes. My vision is still good enough for black on white background text but the inverse colors make it physically hurt when I try to read the same text in the same font size due to the slight astigmatism that I have.

Interestingly I developed astigmatism over a few short days when I was under a lot of mental trauma. Not sure if that was causal or just coincident. Can a serious emotional shock damage eyesight?


I was in the same position as you, not too long ago. I kept reverting back to my familiar light themes.

Switching to The Dark Side finally stuck after using it for a few weeks straight. Now I can't imagine going back. When I switch to an app without a dark mode, it's like staring at the sun.

I don't have any issues with dark mode. I feel like my eyes are more relaxed not having to contend with so much incoming light.


I've noticed people either prefer dark or light when working. It's very binary.

In my 20s/early 30s I really preferred a dark environment when coding. It's how I "grew up" with my first job back in the 90s, based in a cellar.

At some point around being ~36-38 years old I randomly started feeling that I preferred a light environment - a view outside would be really nice too.

I think it's mostly due to what you're used to.


I personally prefer dark mode, but I don't think there are strong scientific arguments for either side. It's a matter of personal aesthetic choice and comfort. If light mode is the one for you, go for it!

edit: and I don't know about other folks, but a big part of the decision for me is tied up in nostalgia for an age I never lived in, the whole like, "hacker aesthetic" thing.


I prefer black on white (or off-white) in Emacs and in the macOS terminal. It reminds me of paper and therefore feels “natural”.


if it doesn't work for you; it doesn't work for you.

Your personal productivity story doesn't have to be like anyone elses. As you work, start paying attention to what conditions seem to work better for you.

Different brains and bodies are different, and programming as a mentally strenuous activity requires that you pay attention to your mental wellness.


+1

This also applies to ergonomics. There's a guideline for good ergonomics... but you'll need to experiment and personalize to fit your own ..umm... physiology(?).

I'm actually a huge fan of dark mode. I also enable flux's night mode the whole day; it seems to make me sleep better since I already have enough blue light in my daily life. I don't need more from a monitor.


Yup same here.

I just can’t do dark mode at all. I’ve tried multiple times, using different themes.

It’s jarring and too contrast-y on my eyes, which is distracting and I can’t scan the code fast because of it.

How’s your eye sight? Last time I checked I was 20/20.


I do have astigmatism, which (reading comments now), might turn out to be important thing in light vs dark mode discussion.


I write code in black windows (#000) and my terminals are also black. Everything else is white (#fff). No problems with that except the ones caused by aging, but I'm still ok with a screen at a harm's length.


I am a dark mode believer, but I absolutely cannot focus when the background is true black.

> Is it that I have to give it more time

It did take me a few weeks to get used to dark mode, but every human is different. It may just not be for you.


One problem with light modes is that they tend to be higher contrast or harsh, or pick their colours in a weird way. Last time I looked at trying light modes anyway, I tried over 20 extensions


It's interesting how I find it difficult to code in a dark mode, while at the same time I just can't use a terminal with dark characters on a light background...


After using light mode for several years, I tried dark mode for a few months. Initially I really liked it, but after a while, it just felt gloomy and I switched back to light mode.


I once released a programming "writer's block" by switch back from dark mode to light mode.

I actually like dark mode, but I feel like I am still in a "light mode" phase.


Dark modes are great, until someone decides to use dark color fonts on dark backgrounds (which constitutes up to 99.9% but not all of the themes)


Probably the same people who use thin, light fonts on bright backgrounds.


I find it hard to focus without dark modes. Eye floaters are way more visible on light screens.


Try customizing your own colors, fontsize, etc. Sometimes default themes just suck.


I prefer it, but can't use on screens when there's heavy glare (macbooks)


Definitely not. Reduces my eye strain. Been doing it for about 10 years


I use dark mode at night and light mode during the day.


It’s just a fad. I never really enjoyed dark mode. I always liked to set my editor’s background to a slightly less bright value like #eee.

Dark mode doesn’t soothe the eyes at all. Just look away after using editor in darkmode and you have these bright patches on your retina. With normal dark onlight background, I never notice this.

Just a matter of not setting your monitor brightness to stupidlevels, for example on an iMac 50 to 60% brightness is plenty. On my iPad i hardly ever use 100% brightness.

I do like my terminal in classic dark mode, so maybe i am contradicting,myself? But it’s not the same: i don’t stare at the terminal continuously, idon’t edit in the terminal (eg. vim, i always use gvim).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: