Language syntax highlighting
I would like to create one uniform syntax highlighting color scheme that works for all languages. For example, comments will always be color X. Keywords will always be color Y. Functions will always be color Z.
Can we all come up with one color scheme that programmers from all languages will be happy with? Please post suggestions.
cscgal
The Queen of DaniWeb
19,420 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
Yes this is a good idea.
I was thinking the colour style of visual studio would be a good one to adopt, in all languages.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
I don't use visual studio.
cscgal
The Queen of DaniWeb
19,420 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
If you google for "visual studio" but hit the image button instead you should get a good idea of what the colouring is like.
Personally, I find the syntax easy on the eye and because, let's face it, visual studio is the most used ide it will probaby be the most accepted.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
cscgal
The Queen of DaniWeb
19,420 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
I'd say just do comments in green. But yes that's a good example. Btw picked you the exact one I was looking at. He he.
Also have a look at this:
http://www.manoli.net/csharpformat/
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
I'm not entirely sure how this is gonna work though. For example, comments in c++ is preceded by a // whereas in vb.net comments are preceded by a '.
Anyway I'm sure you've already thought of this though, otherwise you wouldn't have suggested it.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
I'm not entirely sure how this is gonna work though. For example, comments in c++ is preceded by a // whereas in vb.net comments are preceded by a '.
Anyway I'm sure you've already thought of this though, otherwise you wouldn't have suggested it.
That's already all figured out. It's just a matter of what colors to use where. What about php default syntax highlighting colors? http://us3.php.net/manual/en/function.highlight-string.php
cscgal
The Queen of DaniWeb
19,420 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
That's already all figured out. It's just a matter of what colors to use where. What about php default syntax highlighting colors?
Nope. The comments are pink. As Iamthwee said, I want the comments in green too. Do not italic them or grey out them. It is a bit of a strain on the eye to read the present C/C++ comments.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
My personal preference:
All the colors should be of a similar intensity. The switch from the keyword-yellow to function-underline/blue is too striking.
To follow more closely what I've seen:
comments in green
Numbers, "Strings" and 'characters' in royal blue
Keywords in bold purple
All else is black
C/C++ functions don't need to be colored, but if they are, use a dark color like maybe red
<strong>int</strong> getCharacter()
{
<strong>int</strong> ch; // define the character<strong>do</strong> // loop until a good character is read
{
ch = getchar(); // read a character
} <strong>while</strong> ( (ch == 0x20) || // check for SPACE
((ch >= 0x09) && (ch <= 0x0D)) // check for the other whitespace
);
<strong>return</strong> ch;
}
WaltP
Posting Sage w/ dash of thyme
10,474 posts since May 2006
Reputation Points: 3,342
Solved Threads: 938
I like WaltP's colour scheme.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Of course, if you don't like the color scheme, you can always change your code by using a code color painter.
The color scheme basically the same as VS, but it's probably the best color scheme I have ever seen. Please Dani, change it... :cry:
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
Alright ... but it does take time :) I know how I'm going to go about setting a unified color scheme for all languages. I just haven't coded it yet :)
cscgal
The Queen of DaniWeb
19,420 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
Alright ... but it does take time :) I know how I'm going to go about setting a unified color scheme for all languages. I just haven't coded it yet :)
No probs, take your time. After all it's not a small project. He he :)
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Hmm yes,
To be honest, the more I've thought about the more I think it's not even worth the effort.
Firstly, the only benefit a syntax highlighter will have, is on the code that is actually readable. I.e indented properly, etc. This type of code will mainly come from experienced members, members who we already know write good clear readable code.
The main problem is when noob's post their questions. In most cases forgetting code tags altogether and in some cases, they format their code so badly code tags don't even make a difference. That's is where the problem lies.
The more I think about now, adopting a one-size fits all policy for code will throw a spanner in the works at some point. Someone will complain.
I mean just look at the negative replies you got when you suggested that we have php highlighting Dani.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
The previous two replies have stated pretty much what I was trying in the one before that.
Much like in the world of IDEs: my complaint is that they really ought to not be in the business of writing editors, IDEs, etc. (mostly from the point of view of embedded devices); they ought to leave that to the pros and keep making a better compiler and plug-ins for debugging.
Similarly, I don't think forums should be in the business of writing code formatters, I think they should leave that to the pros. I don't think the pros have seen the demand and don't bother.
But I think if there were [SlickEdit][/SlickEdit] tags, for example, it would be wonderful advertising for the vendor for their product -- plus easy-to-use user-customizable rendering of code on sites that use it. A win-win to me, viral advertising and all.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
Now, instead of agreeing on a color for a comment, we can work on defining what a comment actually is. Then, I can display my comments in grey italics (which looks lovely) and you can display them in green regular (which looks lovely).
The problem with this is that theremust be a default, because most users wouldn't have a clue that they could define their own colors. So first order of business -- as cscgal is thinking of proceeding -- is to define the default color scheme. Anything else comes after.
WaltP
Posting Sage w/ dash of thyme
10,474 posts since May 2006
Reputation Points: 3,342
Solved Threads: 938