Last Updated: September 29, 2021
·
979
· igoramadas

Dark side of the comments

Not what you're thinking :-) Just a quick glance on how I'm using comments to better organize my code.

Some devs say that comments pollute the source code and make it less readable. Depending on your IDE settings I agree, especially if comments are coloured in a such a way that they compete with the code itself. Comments shouldn't steal your attention.

That's why I configured my IDEs to display comments on a quite dark colour, almost blending with the background (but still light enough to be easily read with no eye strain). This way they stay clearly distinct from the code, with the added benefit of helping on separating code blocks because of the added virtual spacing in between code lines. Have a look on the screenshots below:

Comments with standard colour

Dark comments

First one is a more traditional colour scheme, second is my current setup. Small change, huge impact on code organization and readability.

PS: for dark text on light background, logically you would invert things and set comments to a light-almost-white gray colour. Or even better: come and join the dark side of the force and get a dark colour scheme :-)