Consensys / vscode-solidity-auditor

Solidity language support and visual security auditor for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor
GNU General Public License v3.0
569 stars 60 forks source link

Syntax highlighting of inherited variables has very low contrast in dark themes #150

Open Minh-Trng opened 3 months ago

Minh-Trng commented 3 months ago

Variables that are inherited from a base contract are shown in dark blue. This does not work well with dark themes (either default or the one that comes with the extension (see variable eigenPodManager):

Definitely works slightly better on the second one, but both are straining to the eyes imo

alexbabits commented 3 months ago

I agree++. I was looking for a way to change the color of dark blue semantic highlighting for inherited things to something more visible.

The documents currently seem to say that the colors are set in stone: https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor

" Solidity-va.deco.statevars ... decorate statevars in code view (golden, green, blue boxes) Solidity-va.deco.arguments ... enable/disable or select the mode for semantic highlighting of function arguments. (default: 'enable' = 'color and arrow') Solidity-va.deco.argumentsMode ... select the mode for semantic highlighting of function arguments (may require a reload) Solidity-va.deco.argumentsSuffix ... a custom Suffix/Symbol that is appended to the decoration when performing semantic highlighting for function arguments "

alexbabits commented 3 months ago

Fix: Change Inherited State Var color (you can also change other colors if you want):

  1. Locate the extension on your machine. I'm using WSL and I found mine simply at home/.vscode-server/extensions/tintinweb.solidity-visual-auditor-0.2.0. If you are viewing this later, the version or naming might be slightly different.
  2. Go into src/features/deco.js
  3. Search for darkblue. Line 627 has the darkblue CSS decoration style, change it to whatever color you want, like aqua.
  4. Reload your project in VSCode and the color should update.

For some reason there is no color on my inherited functions, which were also dark blue. (But I think this is a general bug with VSCode because inherited functions sometimes simply don't register properly).

Find CSS colors here: https://www.w3.org/wiki/CSS/Properties/color/keywords

Minh-Trng commented 3 months ago

@alexbabits great find! Will leave the issue open, so you can do a PR that changes the defaults if you want to :)