So I finally succumbed to installing version 2, in my new PC. After using the default theme for a month, I decided to take a look at the other choices in the dropdown. Now I can't revert to it because it's disappeared from the dropdown list! I can't remember what it was called, only that it was a dark one and said it was deprecated (so why did it come with my recent install?)
What's really frustrating is that none of the three remaining theme choices highlight the special substitution codes in strings used by functions such as sprintf and snprintf (I don't know the technical term for these, but I mean the %d, %c, %s, etc.) The old theme highlighted them beautifully (in cyan standing out among the dark orange of the other characters in the strings). I have sketches with some fairly large strings in them (several thousand characters) and searching through them to find the characters to be substituted by variables is now painfully slow. Seems a retrograde step not to have that in any of the supplied themes.
I know there are lots of themes that can be downloaded and installed but, to save me hours of hunting through them and testing them, I wondered if some kind soul actually knows of a theme that highlights these characters. The demo code used to show off any of the themes I did look at didn't include any examples with the embedded characters of which I speak.
Are you certain it was the default? If so, there must be a bug in Arduino IDE because it should use only the 'Light" or "Dark" theme by default (selected according to your operating system theme). The deprecated themes were only ever selected by the user; not as a default setting.
I'll provide you with two options for configuring Arduino IDE to use the theme you had before. You can use whichever you think is best:
The Simple Option
Starting from Arduino IDE 2.1.0, the deprecated themes are no longer offered in the "Theme" menu of the Arduino IDE's preferences. However, they can still be selected using Arduino IDE's advanced settings. I'll provide instructions:
Please note the "Dark (Theia)" and "Light (Theia)" themes offered via the advanced setting are deprecated. Arduino does not maintain or support these themes and they could be removed completely from Arduino IDE in a future release.
Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
A menu will appear on the editor toolbar:
Select the "Preferences: Open Settings (UI)" command from the menu. โ You can scroll down through the list of commands to find it or type the name in the field.
A "Preferences" tab will open in the Arduino IDE main panel.
Type workbench.colorTheme in the "Search Settings" field of the "Preferences" tab.
Select "Dark (Theia)" from the menu under the "Workbench: Color Theme" setting.
Close the Preferences tab by clicking its X icon.
The Stable Option
Arduino IDE is built on the Eclipse Theia IDE framework, which allows it to use VS Code themes. A VS Code theme roughly equivalent to the "Dark (Theia)" theme you like is available.
The advantage of this approach is that you are not depending on a deprecated built-in theme that might be removed from Arduino IDE in a future release. The ability to install 3rd party themes in Arduino IDE is officially supported by Arduino.
Another advantage to this approach is that learning how to install 3rd party themes gives you the choice of a huge number of themes. You might eventually find one you like even better.
I'll provide instructions for installing the equivalent 3rd party theme:
Arduino does not maintain or provide support for individual 3rd party themes. If you experience problems with a theme, report it to the theme's maintainer.
Obtaining the Theme
The "Dark (Theia)" theme is based on the "Dark+ (default dark)" VS Code theme. Since it is built in to VS Code, this specific theme is not available in a standalone extension form for download from the VS Code Marketplace. However, there are quite a few 3rd party themes based on the "Dark+ (default dark)" theme there so I think you'll be able to find one to your liking
First, thank you for your swift, detailed reply and sorry for the delay in my response.
Yes. It was a new PC and I never installed v1 on it. However I did update from v2.0.something to v2.1.0 shortly after I finished setting up my new PC. It has a choice of three themes right now: Light, Dark and High Contrast ... had four until I switched from the deprecated one.
Thank you, thank you! I've opted for this option for now. May look into a longer term solution when I have more time to spend on it!
Related to my original problem, I tried using the RegEx option in the Find/Replace feature to locate all instances of %d, %s and %c. in a sketch. The expression %[dsc] does find some of them but, sadly, not all of them. I can provide screenshots comparing a chunk of text in the Arduino editor with what the tool at regexr.com finds in the same text using the same regular expression. It finds all of them. I can provide screenshots of the comparison if anyone is interested in following up on this.
You are welcome. I'm glad you are back to your preferred theming. I think this solution is likely to continue working for some time to come because there are some technical difficulties to removing the deprecated themes and the current approach of not offering them via the preferences dialog is adequate for our purposes.
Same regex on the same text in regexr.com finds all of them.
Edit: Looks like it found one more that I missed - which drives home the point about how difficult it is to not have these highlighted in the default theme.
Thanks. Would you mind pasting a snippet of your sketch code that produces the bug? That will allow me to proceed with the investigation without having to transcribe the text from your screenshot.
I've made a few changes to this sketch (and brought back my helpful theme) since I posted the screenshots, but the snippet below is unchanged, except token in the Set-Cookie data has been renamed pkey and token[p - 1] is now pKey[p]. The weird thing is that the search for regular expression %[dsc] now highlights and finds all four %d in the snippet. I'm not sure what's going on here but I wouldn't have trusted myself if I didn't have the screenshot as evidence that, a few hours ago, it definitely missed out the %d in pb=%d2, pb=%d3 and pb=%d4 but a few lines later found token=%d; (Highlighting's a bit hard to see but the ones it did find were highlighted with a brown background.)
if (f == 'I') {
c += snprintf(temp + c, 2000 - c, "\t\t\t<a class='b' style='background:#00c' onclick='window.navigator.vibrate(100)' href='press?pb=%d2'></a>\n\
\t\t\t<a class='b' style='background:#bb0' onclick='window.navigator.vibrate(100)' href='press?pb=%d3'></a></br>\n\
",
p, p);
}
c += snprintf(temp + c, 2000 - c, "\t\t\t<a class='b' style='background:black' onclick='window.navigator.vibrate(100)' href='press?pb=%d4'></a>\n\
\t\t\t<a id='c' href='/'>Configure</a>\n\
\t\t</div>\n\
\t</body>\n\
</html>",
p);
// Set their position in a cookie
snprintf(temp2, 100, "pkey=%d; Max-Age=86400;", pKey[p]);
server.sendHeader("Set-Cookie", temp2);
server.send(200, "text/html", temp);
Gotta love bugs that come and go for no apparent reason. Not.