How to change search highlight or selection colour in Sublime Text 3

Sublime Text 3 is very popular and widely used code editor. I have been using it for a while now and am quite enjoying it. The good thing is this that it is free to use, except, having a buy prompt here and there which I discard very politely.

Why I need to change selected (selection colour)  background colour?

The default background colour for searched text in Sublime Text 3 is grey* which is no easily visible especially when I am tired or working at night in my default dark theme. So I tried to find a way to change it which I believed that was quite possible, so I searched google for help.

Going through a few sources I was able to do it finally but it was not that easy and straight-forward that I was expecting as I had to spend some extra bit of time against my anticipation.

So here is what I did to change the selection color. I am noting it down here so that someone with similar knowledge of Sublime Text might be benefited from my this “little extra” hunt.

How to change selection colour for searching/search text

First of all I want to mention that most of the additional settings such as syntax highlighting or additional colour schemes come via Package Manager in Sublime Text 3. So one has to Install Package Manager if one hasn’t done it already.  One can install it following https://packagecontrol.io/installation or similar resources.

Changing the selection colour in Sublime Text 3

  • Install PackageResourceViewer plugin using package control (mentioned above)
  • Open the command palette with ⌘+⇧+P on mac iOS (for windows/linux Ctrl + Shif + P) and type prv to get the PackageResourceViewer options.
  • Choose Open Resource >> Color Scheme – Default >> and choose your theme file to edit.
    • If you do not know your default theme file do the following:
      • Open the command palette with ⌘+⇧+P (for windows/linux Ctrl + Shif + tP) and type preferences to get the Preferences – Settings options.

      • Look for “color_scheme” and note down the name
      • Continue to next step
  • Once you have opened the color scheme file, search for “selection” option which has var(grey) value by default in my case
  • Change the value of the selection to something which you like. For example I changed var(gray) to #3399FF
  • Save this file and close.
  • You can even test the selection color by searching in the same file after saving it.

Thanks a lot!

* – This guide applies to Monokai.sublime-color-scheme in particular but can be followed to do it for other themes.

Leave a Reply