Why you are (probably) using the wrong theme
Tags: vscode, themes, programming, productivity
Published: 2021-09-23 20:04:42

## The problem with themes

Ever since I left my trusty notepad++, migrating to VS Code I became somewhat obsessed with finding a "perfect" theme. And by that I mean a theme that I could use without ever looking back. I tried about 30-40 themes, and some of them were really good, most were really bad.

> Before you say it. Yes, peoples tastes are different and there is no theme that is objectively better. Or so you may think.

After searching I settled on Wes Bos' excellent theme [Cobalt 2](https://marketplace.visualstudio.com/items?itemName=wesbos.theme-cobalt2) for a while. Until I got irked by how bright it was, and moved to the extremely popular [Night Owl](https://marketplace.visualstudio.com/items?itemName=sdras.night-owl&WT.mc_id=twitter-social-sdras) by Sarah Drasner. The problem, I still wasn't entirely happy. *Why italicize variable names?* It makes them harder to read. Eventually I started to customize it (and like everyone else in that headspace; maybe I'd publish my own theme and gain some notoriety for it). 

## Deus Ex Machina

Enter, one indescript day in April. A user by the name u/kingcool1432 on reddit posts about a [new theme they have made](https://www.reddit.com/r/vscode/comments/n1c39j/chandrian_a_vscode_theme_designed_to_making/): Chandrian (a reference to an unfinished trilogy of fantasy books called [The Kingkiller Chronicle](https://en.wikipedia.org/wiki/The_Kingkiller_Chronicle)). 

### What made this theme so special?

In the post the author claimed the following:

> Chandrian is a semantic syntax highlighting theme, where the colors mean something, beyond just looking pretty. It's designed explicitly to make scanning large code-bases easier and to make errors more obvious.

Another user commented:

> Isn't every theme designed to do that?

The answer should have been a resounding "Yes!". The reality is, that if that were the case then most themes have failed their job. 

So how did the [Chandrian theme](https://marketplace.visualstudio.com/items?itemName=narenranjit.chandrian) succeed where other themes have failed?

## Syntax Highlighting done right
> **Note!** *The examples I am showing in this post are from [my own version](https://marketplace.visualstudio.com/items?itemName=aMediocreDev.chandrian-owl&ssr=false#overview) of this theme. The syntax highlighting has stayed largely the same.*

Let's take a look at some example HTML.
![html syntax example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4npteyxx9axoapm3qwwf.png)

*Doesn't look any different, perhaps? Did you spot the syntax error?*

The syntax is highlighted in a way intended for you to recognize errors immediately in HTML, and shades of the same color are used to indicate different types of tags. Links are a stark contrasting color, while strings have their own reserved color space (and so does numbers). This red thread is interwoven throughout the whole theme. How about some SASS/CSS?
![sass syntax example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/milnqq303gsee1kiuvhn.png)

Again, the syntax is highlighted in such a way that you can easily identify different syntactical components. Variables? Orange, **!important** red, so as to best catch your attention. This is all carefully crafted by a person who has taken great care to understand how we read code. If you haven't already give this theme a star on [github](https://github.com/narenranjit/chandrian-theme), or download it on [the marketplace](https://marketplace.visualstudio.com/items?itemName=narenranjit.chandrian).

If you haven't been convinced yet, then this certainly will!
![javascript syntax example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s83wof9rxl71tbh69hkm.png)

It's just so easy to skim through the code. Grammar you do not need to worry about have muted colors. Variable names are always white and functions blue, while classes are teal.

> But that is standard fare, no?

Many themes make distinctions between these things. The real power of this type of syntax highlighting is how control flow pops. Red colors should be avoided, like `debugger` or `this`. While orange means you are breaking flow in some way. Yellow indicates conditionals, and in Typescript a muted rust red indicates a type declaration or interface. 

And this only works because the surrounding syntax has a cool color, and so doesn't distract from the warmer colors. **This is the way, without a shadow of doubt.**

> And for those of you who at this point are bursting with a need to be contrarian. How about some nested JSON:
![json syntax example](https://user-images.githubusercontent.com/9851733/134567689-4bd721bc-dff9-43d3-99ec-6fb7426ebdfe.png)

## What's with blue on blue?
The [Chandrian theme](https://github.com/narenranjit/chandrian-theme)'s UI is barely modified from VS Code's standard UI. And as such looks like the cover image. For reference:
![Chandrian Theme example](https://user-images.githubusercontent.com/9851733/134575800-f59ae8ab-1723-45ab-9a11-5d583bbb0b56.png)

This was the only gripe I had with this theme. So I took my favorite theme UI (Night Owl) and transposed the syntax highlighting on top of it. For me this works really well. I find the contrast good enough and the blue colors are relaxing to look at. 
![Chandrian Owl theme example](https://user-images.githubusercontent.com/9851733/134575876-4cd8f76b-37d3-4035-86e0-5decd06b784d.png)

If you are like me, you can find my version of the Chandrian/Night Owl theme [here](https://marketplace.visualstudio.com/items?itemName=aMediocreDev.chandrian-owl&ssr=false#overview). 

If not, then I would at least ask you to try out the Chandrian Theme. I'll be willing to bet that you will never look at another theme the same again 🔥🦉