// HACKER NEWS — CYBERSECURITY
Highlighting My Code Based on How Much I Care
After failing multiple times to create a light color theme that was not distracting, I attempted to create one that was entirely grayscale. The goal was to make certain elements stand out—more or less—against the baseline of black-on-white variable references and function calls. Relatively subtle changes in text and background brightness were enough to achieve a smoother and more efficient reading experience.
I was reading an article by Nikita Prokopov about how “everyone is getting syntax highlighting wrong” [1]. It struck me that I never really thought about my code being highlighted. I’m pretty basic and have used the default VSCode Dark Theme since I switched away from JetBrains forever ago. I’ve gotten so accustomed to the same theme and colors that over the years I became blind to it.
This section in particular of Nikita’s post stood out to me:
Here’s another test. Close your eyes (not yet! Finish this sentence first) and try to remember what color your color theme uses for class names?
If the answer for both questions is “no”, then your color theme is not functional. It might give you comfort (as in—I feel safe. If it’s highlighted, it’s probably code) but you can’t use it as a tool. It doesn’t help you.
What’s the solution? Have an absolute minimum of colors. So little that they all fit in your head at once.
I know theres some blue, other blue, and for sure some purple in there… not really sure which is which though. Ok, so they are saying that if I can’t remember, its because there’s too many colors in my theme. Well, lets just make a new one with fewer colors, how hard could it be?
I’m sure you can guess where this is already heading, but it turns out if you’re trying to do a light theme, it’s actually really hard! Basically, in order to have contrast with a white background, colors need to be darker than they would be on a dark theme. Darker colors are less vibrant, and thus offer less perceptual impact.
After messing around, I found that it was hard for me to make a theme that felt like it belonged on this site (mostly 1 bit aesthetic). It’s not that the colors didn’t work to make certain sections stand out, it was that they made things stand out too much.
Why should code even be highlighted in the first place?