(less importantly: Also, the available VS Code dark themes (and, indeed most online Nim documentation, guides, and books) are, when displayed in dark mode, too garish and visually "loud" for my taste. In short, I am of the opinion that they too often use token colors more suitable for white backgrounds than dark backgrounds.)
Work-in-Progress: VS Code can help with all of these issues, but getting it to visually play nice with Nim does require editing several files. The below is a work in progress, submitted to you - who are almost certainly more Nim-savvy them me - for review and improvement.
The current revision (v0.1), including installation instructions, is available at: https://drive.google.com/file/d/1FVatDdCsGz7pRNsQq_AUJm0hQeKPeVxJ/view?usp=sharing
Plan:
1) Sort out at least the three issues above, and either 2a) hand things off to be incorporated into a larger Nim-for-VS Code extension, or failing this, 2b) get a marketplace-ready extension published.
Colorizing the Nim-language tokens: The first and most important task is to colorize the tokens defined in the VS Code-nim extension for VS Code. (https://github.com/nim-lang/VSCode-nim/blob/main/syntaxes/nim.json)
The objective here is to: 1) capture and differentiate all important tokens, 2) distinguish those that are most salient - affecting program logic most, or most often requiring particular attention - with the most distinctive and saturated colors, and 3) reduce overall saturation and garishness, so attention can be easily paid to the truly critical stuff. Like errors.
Item 3 is largely subjective. Others naturally will have very different preferences than do I, so we can pay little attention to it here. Happily, once a Nim-kosher theme is supplied, it's easy to substitute your preferred color scheme by simply replacing colors.
Item 1 and at least some of item 2 are, therefore, the action items. It's here I ask for help from experienced Nim coders. Please install the above, look at your code with the "Dark Verdure 2025" theme active, and critique how it colorizes or fails to colorize your work in a way that respects Nim tokens, especially the salient ones.
The basic question to ask yourself is "Are you seeing the potential for more readable and scanable Nim code?" (perhaps once you get the colors to your own liking)
If things look promising, please have a read of <download>/theme/Dark Verdure 2025.json - specifically, the "tokenColors" section. You will see some of the tokens defined in VS Code-nim/syntaxes/nim.json. Are at least the important ones recognized? In your opinion, is their relative importance reflected in their relative distinctiveness on-screen?
Colorizing indentation: In Nim, indentation really matters. So we highlight it with theme-appropriate colors. See the bottom of the theme file.
Colorizing brackets: In a VS Code theme file, bracket and indent colors can be specified. See the bottom of the Dark Verdure 2025.json file. However, if we turn on the (commonly-used) "colorize brackets" option in VS Code, all possible brackets are colorized, which colorizes Nim-style '<' and '>' tokens as errors. I am not able to include this in a theme. To fix this, (one option is to) go to our preferred VS Code settings file and insert (if unfamilar with file locations, read https://code.visualstudio.com/docs/editor/settings#_settings-file-locations):
"[nim]": {
// This stops the setting "colorize bracket pairs" from colorizing < and >.
- "editor.language.brackets": [
- ["[", "]"], ["(", ")"], ["{", "}"]
],
- "editor.language.colorizedBracketPairs": [
- ["[", "]"], ["(", ")"], ["{", "}"]
],
},
A better option would be to include a Nim-language settings file in the extension.
Edit: I just can't seem to get the reStructure-based forum formatting to stop adding and subtracting carriage feeds or garbling attempts at list organization. I'd much rather post plain text than this. Sorry for any readability issues.