4 ms·
What is your opinion on syntax-coloring of code?
Here is an example:
http://crystal-lang.org/
Not for or against Crystal, was just most handy URL.
- Finnucane 11y agoI have red-green color blindness, so it's a problem. Dark red on black is bad, green with yellow or brown is bad, shades of blue and purple can be hard to distinguish. Yellow on black good, bright red on light background good.
- bbody 11y agoDo many of them have the option to change the colours?
- Finnucane 11y agoYeah, it seems like most editors now it's not that hard to customize the settings--so I end up futzing around with the colors every now and then to see if I can come up with something better. It remains a not very satisfactorily solved problem.
- bbody 11y agoI am not quite sure which part of it you are asking about. However in general I find syntax highlighting useful, helps quickly get the gist of code. I am indifferent on colors, as long as they are consistent.
- vram22 10y agoI was asking about the idea of its usefulness in general.
- partisan 11y agoAs opposed to not coloring it? I am for syntax highlighting. Those particular colors you see on the site are a little bit harsh, but maybe because of the bold/font weight. I use the default dark color scheme on Visual Studio and while the colors are a little muted, they feel easier on the eyes.
- vram22 11y agoYes, I meant as opposed to not coloring it at all, i.e. all the code is of one (foreground) color. Sorry if I did not make it clear enough earlier.
- davismwfl 11y agoSyntax highlighting is good overall, the best is having some sane defaults and the IDE/environment allowing the user to make tweaks to it. I personally don't like dark schemes and prefer the white backgrounds now. I never thought of the color blind side of it till I read Finnucane's point, but the ability to tweak the colors mostly would solve that I guess. I also really like that most editors are starting to highlight local, global, class members/parameters/variables all subtly different. It makes identifying them even easier. However, having that type of highlighting doesn't remove the need for good naming (and coding) standards to make it easy to distinguish proper scope etc.
- bbody 11y agoIt would be interesting if style guides were also integrated, e.g. you have a non-standard variable name it highlights the background in a striking colour, or the Word style red squiggly underline.
- davismwfl 10y agoYea, that would be nice. Basically a style checker that integrated into the syntax highlighting in some way.
- vram22 10y ago>Syntax highlighting is a better and more widely used term, I guess.
- vram22 11y agoThanks to all those who comment.
- vram22 11y agoI realized that I did not make the question clear enough. I meant : "Do you prefer or not prefer syntax-coloring (vs. monochromatic B/W or W/B)?"
- bediger4000 11y agoI turn it off and on. Sometimes, syntax coloring can be of benefit, like mismatched single- and double-quotes un-terminated strings. Other times, the colors make things less clear, and I turn it off. Vim's C syntax coloring is an example of the latter. As a side note, if you're looking at PHP malware, which is almost always in a single long, long line, syntax coloring can be quite time consuming.
- vram22 10y ago>Vim's C syntax coloring is an example of the latter. Yes. On Vim I do: :syntax off Find all the different colors too jarring.
- atsaloli 11y agoI prefer syntax-coloring -- makes it easier to catch errors quickly, as the colors go all wonky if I miss a parens or a double quote, etc. This way I can catch the error right in the editor, before it ever hits the parser.