What do the syntax colors mean?

Hi,

I am new to programming. I am wondering where I can find an explanation of the syntax coloring used in the Arduino 1.0.5 IDE.

Also, Is there a way I can print out the Arduino commands? Are they available anywhere in a printable format? I would find it easier for me if I refer to a hard copy rather than using the on line Language Reference.

Thanks in advance,

bash11

Scroll down to the bottom where it talks about KEYWORDS.

Thanks for your reply. I read the link mentioned in the reply. I did not see any reference to the color of the font except by just reading the sketch and noting the colors. I did not see any correlation I am new to programming so this may be obvious to more experienced programmers. What do the gold, blue, red, black, and grey color fonts represent? For example, are all functions one color, and all variables another, etc.?

I would still like to print out or buy a hard copy of the language reference. Anyone know where I can find a source?

Bash11

If it helps, I personally just ignore them. They are just "eye candy" as far as I am concerned. Often words get highlighted for the wrong reasons, and other words are not coloured, although they should be.

Having said that they probably have one colour for C operators (like "while", "for"), one for comments, and one for "well-known" functions (like Serial.print).

The colouring of comments is useful, I suppose, and colouring function names help you see if you have misspelt them, but as I said, don't get too excited. :slight_smile:

Yes it’s helpful for spotting where you forgot to close a comment or a string or misspelt a keyword, but as Nick says it mostly eye candy.

The most useful function if this type is the greying out of inactive code (say inside an #if block) and the IDE doesn’t do that. I now consider this to be a “must have” feature in an IDE.


Rob

Hi forum,
for a 'newb' struggling to get to grips with IDE formatting, text colours, the inumerous libraries all doing the same thing but with possibly minute changes and the name change of the beloved "Arduino" to the comical "Genuino" - what do the different colours of code in the various Arduino IDE mean?
I have some variables automatically coloured orange, whereas others are coloured black - what is the difference to cause this?
Thanks
D6

You had to necro a thread from 2013 to ask that question? When it is answered in the same thread?

aarg:
You had to necro a thread from 2013 to ask that question? When it is answered in the same thread?

Probably cause the original question never got answered- which seems to be a trend. It wasn't asked what peoples opinions are about the colors. He asked what the colors meant. That said, saying they are eye candy didn't answer the question but rather answered "I ignore them". The site posted didn't offer anything having to do with colors.

The author of the IDE must have had a reason for specific colors and for noobs like me, no matter how trivial to the experienced people, we just want simple answers to the question. What do the colors represent or were intended to represent in IDE? TEAL? RED? GOLD? Etc.? Thanks for sharing the answer!

artemas:
The author of the IDE must have had a reason for specific colors and for noobs like me, no matter how trivial to the experienced people, we just want simple answers to the question. What do the colors represent or were intended to represent in IDE? TEAL? RED? GOLD? Etc.? Thanks for sharing the answer!

So the answer to what they mean is, "Not a damned thing."

There is a list of words that shall be colored. Each library adds in its own additional list. And it doesn't matter if you are actually using the library, just the fact that it exists in your libraries folder will cause any words on its keywords list to turn orange. Once you have a few libraries, nearly everything is turning orange and its all about stuff you're not even using.

Now many "grown up" IDEs use coloring to actually represent things. Comments in one color, variables defined in your code in another color, language keywords in another color, constants in another. It can help in lot of ways. Apparently someone long ago decided that the Arduino IDE should emulate that, but they did it in the crappiest possible way and it doesn't work very well at all.

So the real answer is that those colors are just there for you to ignore. They're not going to really help you as they aren't consistent. They're just a red herring to make you think there's something going on that isn't.

They're just a red herring

or an orange or teal herring.

Just to help those just learning like me...

Functions are colour coded in orange.

Variables are colour coded in green, aqua or teal, what ever you want to call it.

and

Structure are colour coded in light greenish or what ever it is.

If you miss type or don't use exact case sensitivity for something in the IDE area such as typing "Input" this way the text will stay black. If it were typed "INPUT" it will turn the correct colour and the correct code is then usable.

As for meaning for the colours, as stated previously there is none real meaning, they are just a helpful guide.

This link below is to the arduino reference library that has a heap of colour coded programming language information...

All the "word" type language ALL work the same colour coded way in the IDE the ones that don't colour up are the ones that aren't words such as ++ or >=

1 Like

So, for someone who has used the Arduino IDE for several years now, why are commented sections formatted so faintly they can not be read and have to be uncommented to enable reading?

The procedure is clunky but, you can change the colors. See this thread.

D6equj5:
So, for someone who has used the Arduino IDE for several years now, why are commented sections formatted so faintly they can not be read and have to be uncommented to enable reading?

It's to remind you that the comments don't always keep up with the code, so you should be wary of trusting them :stuck_out_tongue:

Or to remind you to either. wear glasses or adjust the contrast of your screen.

I've found that the colors are more distinguishable from each other, and the background, using the dark theme.

Yeah i actually also find them helpful, since i am a tad typing dyslexic, and tend to tyoe things like unit8_t which doesn't light up, and my ESP code looks totally different if i have the UNO selected as my board. I once did see a topic somewhere about using Codeblocks as an IDE but i never really managed to get that to go (Codeblocks is great though)

ChrisYoung:
Just to help those just learning like me...

Functions are colour coded in orange...

It was a relief to see that someone JUST ANSWERED THE QUESTION.

Thank you Chris!