#include <library>, library in bold and/or colored or black?

Status
Not open for further replies.

PaulS

Well-known member
Not an issue but just trying to understand something...
While I was playing with an SSD1306-based OLED display, I noticed that the library names were shown in bold and/or colored or black in the Arduino IDE, like below:

Capture.PNG

I googled for an explanation about the coloring but did not find one.
Using Arduino 1.6.4, Teensyduino 1.23 [all libraries installed].

Does anyone of you know?

Thanks,
Paul
 
Here is my guess.

Libraries can include a keywords.text file. That causes selective bolding and coloring of the key terms and variables. This in turn helps users type with fewer errors. I bet standard libraries in the IDE get a similar treatment, i.e. bolding of the include and so on as well.
 
Thanks.
Just checked: the SPI and Wire library have a keywords.txt file included, the Adafruit libs don't. So that makes up for the coloring most probably.
Still open why bold or regular...
 
I am pretty sure all the textual features you are observing are driven by the keywords.txt files - every little detail.
 
Wire and SPI are keywords defined in the keywords.txt.
Wire is marked as KEYWORD2 (=colored)
SPI is marked as KEYWORD1(=colored and bold)

You can change the font color and font weight in "Arduino\lib\theme\theme.txt"

Code:
# TEXT - KEYWORDS

# FUNCTIONS
editor.keyword1.style = #D35400,bold

# METHODS
editor.keyword2.style = #D35400,plain

# STRUCTURES
editor.keyword3.style = #5E6D03,plain

You have to edit theme.txt after every Arduino IDE update.
 
Robsoles, you are completely right.
In the Wire\keywords.txt file, it states "Wire KEYWORD2". Change that to "Wire KEYWORD1" and Wire is displayed in bold in the IDE.
Found the definition in C:\Program Files (x86)\Arduino\lib\theme\theme.txt:
Code:
# TEXT - KEYWORDS

# FUNCTIONS
editor.keyword1.style = #d35400,bold

# METHODS
editor.keyword2.style = #D35400,plain
The actual color is also defined in this file.

Curiosity satisfied...

Thanks,
Paul
 
Yes, it's all controlled by theme.txt and the many keyword.txt files.

Not all libraries follow highly consistent ways for their keyword.txt files, even in the libs included by Arduino.
 
Status
Not open for further replies.
Back
Top