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.

Recommended Answers

All 51 Replies

Member Avatar for iamthwee

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.

I don't use visual studio.

Member Avatar for iamthwee

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.

Member Avatar for iamthwee

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/

Member Avatar for iamthwee

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.

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

commented: Good idea if you can pull it off +6

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.

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

[b]int[/b]  getCharacter()
{
    [b]int[/b] ch;             // define the character
    [b]do[/b]                  // loop until a good character is read
    {
        ch = getchar(); // read a character
    } [b]while[/b] ( (ch == 0x20) ||    // check for SPACE
             ((ch >= 0x09) && (ch <= 0x0D)) // check for the other whitespace
            );
    [b]return[/b] ch;
}

I like WaltP's colour scheme.

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:

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 :)

Member Avatar for iamthwee

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 :)

Quite a good idea. Unfortunately, it would be hard to get ALL compilers of ALL languages to comply.

I say, you should back off from a one-scheme-for-everybody. In all my experiences, I have never found a team where everybody likes the same colors or bold/italic/underline etc. Not only that, but my IDE's color scheme is tailored for me, and your scheme will look (insert variation of "ugly" here).

Back off, I say, but back off one step only!

Why don't we invent a CSS for program text?

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).

Every code editor should implement a syntax analyzer that emits document events (or something) when you type your code, and you'll get what you want.

Simple!

Member Avatar for iamthwee

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.

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.

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 there must 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.

Creating a uniform color for all langauges is a *Herculian* task not to be bothered with for the time being.

Then again it depends on Miss Dani -- is she comfortable writing php scripts for highlighting constructs for each and every language seperately or she thinks that keeping a uniform color scheme would be more like it.

Also it should be kept in mind that you can never get everybody to agree to a single thing..

Creating a uniform color for all langauges is a *Herculian* task not to be bothered with for the time being.

Why not break it down a little bit?

For example, Dani could simply work at C/C++ syntax coloring, test different versions, perhaps get us to vote on which one we like the best, and set it in place. Once Dani's confident that the color scheme works, she can possibly apply it to other languages.

Why not break it down a little bit?

For example, Dani could simply work at C/C++ syntax coloring, test different versions, perhaps get us to vote on which one we like the best, and set it in place. Once Dani's confident that the color scheme works, she can possibly apply it to other languages.

But I think you miss the point here. This thing has actually started(methinks) so that the other langauges which dont have a proper syntax highlighter( like scheme ? ) get a highlighter.

Starting work on C++ again and then testing those samples out might again delay the very reason why we need a common highlighter.

But I think you miss the point here. This thing has actually started(methinks) so that the other langauges which dont have a proper syntax highlighter( like scheme ? ) get a highlighter.

Starting work on C++ again and then testing those samples out might again delay the very reason why we need a common highlighter.

But we don't even agree on the color scheme for C/C++ at the moment, and so changing the rest of the languages wouldn't really make sense.

But yes, I see your point, and it will take forever to get a common color scheme. I think C/C++ is the most important at the moment, as that is the most popular language on these forums, so if that could be tweaked a little bit it would be great. (Not to say that syntax coloring is bad at the moment, I'm just saying it could be improved.) But Miss Dani is probably very busy at the moment, so it probably won't happen for a while.

Btw, nice avatar. :D

But we don't even agree on the color scheme for C/C++ at the moment, and so changing the rest of the languages wouldn't really make sense.

Naa..its not changing, it fixing the broken highlighting. Mr. Rashakil previously complained about the broken highlighting of Scheme. So its not actually changing the rest of languages but actually fixing them.

I think C/C++ is the most important at the moment, as that is the most popular language on these forums, so if that could be tweaked a little bit it would be great.

Psst...dont let the people of other language forums hear this .....:mrgreen:

Btw, nice avatar.

Hehe thanks -- suits my personality. Evil, calculating, serious, dark....:twisted:

Btw, nice avatar. :D

Hehe thanks -- suits my personality. Evil, calculating, serious, dark....:twisted:

And a much better role model :confused: -- you're not smoking anymore!

I just love your new avatar, WaltP.

And a much better role model :confused: -- you're not smoking anymore!

I didnt know I was a role model ;)

And btw can someone please tell me how to nest the quotes.

I tried it many times but it just doesnt happen, dont know what I am doing wrong.

I just love your new avatar, WaltP.

Thank you. Thought you might... :mrgreen:

And a much better role model :confused: -- you're not smoking anymore!

I didnt know I was a role model ;)

OK, maybe roll model, then...

And btw can someone please tell me how to nest the quotes.

Editing...

Select Multiquotes on the original post/quoted text and the post you are directly quoting. This gives you
[QUOTTE=WaltP;280530]And a much better role model -- you're not smoking anymore![/QUOTTE]
[QUOTTE=~s.o.s~;280534]And btw can someone please tell me how to nest the quotes. [/QUOTTE]

Now just move the 2nd quote tag to the beginning:
[QUOTTE=~s.o.s~;280534][QUOTTE=WaltP;280530]And a much better role model -- you're not smoking anymore![/QUOTTE]
And btw can someone please tell me how to nest the quotes. [/QUOTTE]
giving you

And a much better role model -- you're not smoking anymore!

And btw can someone please tell me how to nest the quotes.

See above... :cheesy:

But that takes effort!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.