HTML5 game publishing
How to Reduce Eye Strain When Working With Code All Day
Font size, line height, contrast, dark versus light themes, screen setup and breaks for developers, with a copy-ready VS Code settings example.
Reading code is close work by definition: small monospaced text, a dense layout, hours at one distance. Developers often describe the result as dry, tired eyes, tension headaches and text that gets fuzzy by mid-afternoon. Most of that is the same digital eye strain every heavy screen user gets, and most of it responds to practical changes in the editor, the screen and your habits.
This guide covers what actually helps: text settings that improve readability, how to choose between dark and light themes, the break habits with the best support, and an example VS Code configuration you can copy. It is general information, not medical advice.
What is going on in your eyes
The American Academy of Ophthalmology (AAO) describes digital eye strain as blurred vision, achy or uncomfortable eyes and dryness, with tearing or stinging, caused mainly by long uninterrupted screen time, screens that glow brighter than their surroundings, and glare. It notes people blink about 15 times a minute normally but only about 5 to 7 times a minute on screens, which dries the eye surface, and that digital eye strain does not cause lasting damage.
Coding adds three specific habits:
- Deep focus: you stare, blink less and skip breaks.
- Tiny text: you shrink fonts to fit more code on screen.
- Constant context switching on the same screen: editor, browser, terminal and chat, all at the same distance and brightness.
Make the text easier to read
Font size and scaling
If you lean toward the screen or squint, the text is too small. OSHA's monitor guidance notes that text size should be increased on smaller monitors since viewing distance may stay the same, and that monitors too far away cause leaning and eye strain while monitors too close strain focus. A good test: you should read the code from a comfortable, upright position without moving your head forward. Modern high-density displays render text sharper, so scaling the operating system to 125 or 150 percent is often better than shrinking fonts.
Line spacing and letter spacing
The Web Content Accessibility Guidelines (WCAG) set minimum spacing that users must be able to apply to web text without loss of content: line height of 1.5 times the font size, and letter spacing of 0.12 times the font size. Those figures are for websites, not editors, but they are a useful reference for what readable spacing looks like. Code is usually set tighter, and many developers find a line height of about 1.4 to 1.6 easier on the eyes than the default packed layout.
Contrast
WCAG success criterion 1.4.3 requires a contrast ratio of at least 4.5:1 for normal text and 3:1 for large text. Low-contrast themes, such as grey comments on dark grey, look elegant and are tiring. Check that comments and punctuation are still readable, not just the keywords. Many editors let you adjust token colours, or you can choose a theme that meets the 4.5:1 ratio throughout. The VS Code terminal even has a minimum contrast setting that adjusts colours automatically.
Cleaner interface
- Turn off distractions that move or flash: blinking cursors if they bother you, animated scrolling, animated minimaps.
- Use a quieter syntax theme with fewer colours.
- Close panels you do not need so the code is in the centre of your view, not at the edge.
Dark theme or light theme?
This is the most argued topic in developer circles and the evidence is not decisive. Some laboratory studies on reading found dark text on a light background gives better performance for many people in normal lighting, while many users find dark themes more comfortable in dim rooms. Evidence that either theme reduces eye strain over a long day is mixed, and people with astigmatism sometimes report that bright text on a dark background looks blurry or glows. The AAO's advice about brightness is more practical than any theme advice: keep the screen from being much brighter than its surroundings.
| Situation | Often works better | Why |
|---|---|---|
| Bright room, daylight, windows | Light or high-contrast light theme, moderate brightness | A dark screen in bright surroundings shows reflections |
| Dim or night room | Dark theme with softer contrast | A white screen in a dark room is far brighter than its surroundings |
| You have astigmatism and see glowing text | Light theme or dark grey (not pure black) background | Individual comfort varies |
| Long evening session | Warmer, dimmer theme and night mode | Less glare and less light before sleep |
Practical advice: try each for a week at the right brightness, choose the one that leaves you least tired, and set the editor to follow the operating system's day and night mode so it adapts.
Screen, room and distance
- Distance: OSHA gives a preferred range of 20 to 40 inches (50 to 100 cm) from eye to screen, and the AAO suggests about 25 inches.
- Height: top of the screen at or slightly below eye level, with the centre about 15 to 20 degrees below horizontal.
- Glare: place the monitor at right angles to windows, and avoid lights behind you that reflect on the screen.
- Brightness: match the screen to the room. If a white web page looks like a lamp, lower the brightness.
- Glasses: the AAO notes computer glasses can be made for the intermediate distance, about 20 to 26 inches. OSHA adds that bifocal wearers may need to lower the monitor or use single-vision lenses for computer work. If you are in your forties or older and read code more comfortably when you push your chair back, ask an eye care professional.
Breaks that help
- 20-20-20: every 20 minutes, look at something at least 20 feet away for at least 20 seconds. This is the AAO's formulation. Use compile times and test runs as natural triggers.
- Blink deliberately during the break, and use preservative-free artificial tears if your eyes feel dry, as the AAO suggests.
- Stand and look out of a window between tasks. Distance focus plus movement is a two-in-one break.
- Avoid direct airflow from vents and fans pointed at your face.
Blue light glasses
The AAO says there is no scientific evidence that blue light from digital devices damages the eye and does not recommend special blue-light-blocking glasses for computer use. A 2023 Cochrane review of 17 trials found that blue-light filtering lenses may not reduce short-term computer-related eye strain compared with non-filtering lenses. Spend on a proper eye exam and a correct prescription first.
Example: readability settings in VS Code
These are real VS Code setting names. Adjust values to your screen and taste. VS Code's settings.json allows comments.
{
// Text size and spacing
"editor.fontSize": 15,
"editor.lineHeight": 1.6,
"editor.letterSpacing": 0.2,
"editor.fontFamily": "'JetBrains Mono', Consolas, 'Courier New', monospace",
"editor.fontLigatures": false,
// Less visual noise
"editor.minimap.enabled": false,
"editor.renderLineHighlight": "line",
"editor.cursorBlinking": "solid",
"editor.cursorWidth": 2,
"editor.smoothScrolling": false,
"workbench.reduceMotion": "on",
// Easier structure
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
"editor.rulers": [100],
"editor.wordWrap": "on",
// Terminal readability
"terminal.integrated.fontSize": 14,
"terminal.integrated.minimumContrastRatio": 4.5,
// Follow the OS light/dark mode
"window.autoDetectColorScheme": true,
"workbench.preferredLightColorTheme": "Default Light Modern",
"workbench.preferredDarkColorTheme": "Default Dark Modern",
// Zoom the whole interface a step if menus are small
"window.zoomLevel": 1
}
What each group does:
- Text settings enlarge the font and give lines room to breathe. If you use ligatures and like them, keep them on; if they make the text harder to read for you, turn them off.
- Noise reduction turns off the minimap, smooth scrolling and extra motion, which cut moving elements and distractions.
- Structure helpers let you scan code faster with less squinting.
- The terminal contrast setting adjusts foreground colours automatically so dark blue on black does not happen.
- Auto theme switching adapts the editor to day and night without manual changes.
The VS Code documentation lists these options in its settings and themes guides, and has an accessibility guide covering screen zoom and high-contrast themes if you need them.
When to see an eye doctor
- Strain persists after you fix breaks, lighting and setup.
- You have frequent headaches, double vision, or blurred distance vision after screen work.
- Your eyes are red or painful, or drops do not help dryness.
- You have not had an eye test for more than a year or two, or you wear glasses and feel they are out of date.
Sudden vision loss, a curtain over part of the view, a shower of new floaters, flashes of light or severe eye pain needs urgent same-day care.
Developer eye comfort checklist
- I can read my code from an upright position without leaning in.
- Font size and line height are comfortable, and comments are readable.
- My theme matches the room light, and my screen is not much brighter than the room.
- No window or lamp reflects on the screen.
- My screen is 20 to 40 inches from my eyes, with the top at or just below eye level.
- I do a 20-20-20 break at build or test pauses.
- I blink deliberately on breaks.
- My glasses are up to date for the distance I work at.
Sources
- AAO: Computers, digital devices and eye strain and blue light guidance.
- OSHA: Computer Workstations eTool: Monitors.
- W3C: WCAG 1.4.3 Contrast (Minimum) and 1.4.12 Text Spacing.
- Cochrane: Blue-light filtering spectacle lenses (2023).
- Visual Studio Code documentation: User and workspace settings, Color themes and Accessibility.
This article is general information and not a substitute for an eye examination. Related: how to prevent wrist and hand pain when coding for long hours.


