3 ms·
Syntax highlighting can help structuring your source code when done well and tastefully - coloring your source in all bright colors of the rainbow rather achiev
by _ph_ 11y ago
Syntax highlighting can help structuring your source code when done well and tastefully - coloring your source in all bright colors of the rainbow rather achieves the opposite effect.
Personally I am working with a white background, so I try to keep the syntax colors all very dark, so while the different colors can be seen, they should not distract from reading. The correct amount of highlighting very much depends from the language at hand, but it can be very helpful in separating elements, just as an example take this function parameter list:
func foo(name, family string, age, size int) {
The correct reading of this parameter list entirely depends on the placement of the commas and the knowledge that "string" and "int" are parameter types - highlighting the type elements can help a lot.
With the availability of high-dpi displays, perhaps colors should be replaced with more traditional ways of markup as used in book-printing, replace coloring with different typesets and fonts.
- frou_dh 11y ago> coloring your source in all bright colors of the rainbow rather achieves [badness] Low-hanging fruit is the braindead R/G/B/Cyan/Magenta/Yellow used by some terminals in response to ANSI escape codes: https://sdkmvx.files.wordpress.com/2008/08/ansi-colors.png https://sdkmvx.files.wordpress.com/2008/08/ansi-colors.png In my mind, there's three types of colouring: None, Designed-By-Human, and the aforementioned Eye-Searing-255 (which should really be killed off or at least not be the default for anything used seriously). It's disgusting to open source code using vi or similar and have it presented in Eye-Searing-255.
- teh_klev 11y ago> Eye-Searing-255 Lol....this. If your primary workstation OS is Windows then I recommend grabbing a copy of MobaXTerm. It has the ability to override and tame the "Eye-Searing-255" beast with its own themes (Solarized Dark and Light, Pastels etc). No more "oh-my-god-my-eyes" when you open up "ooby-doofer.pl" in vim.
- gdwatson 11y agoOne of my criteria for choosing a theme for source highlighting is that it not make keywords both bright and bold at the same time, which makes code harder to read and to scan. A startling number of themes do this. Judicious, typographically aware use of bold and italic or oblique in source highlighting can be a wonderful thing.
- cxa 11y agoI've found an agreeable middle ground, which is to keep syntax highlighting on but to use a monochrome theme, where different types of tokens (like you mention) are distinguished by contrast instead of color. However, I don't personally favor pure blacks or whites (just ask any master printer). I do make exceptions. For example, I color my cursor, as well as highlight matching parens if the cursor is on one of the pair (changing just the foreground color of the paren, not inverting it). The only color I use is red. I don't make any objective claims that this is better, my aim is to make something "done well and tasteful", as you say.