Change highlight colour in Sublime Text 3?
Solution 1
You can see which theme you are using by going to
Preferences>Colour Scheme
and see which one is ticked.
Open the theme file and find the key that says:
<key>selection</key>
Go to a site that shows hex colour codes (like this one http://html-color-codes.com/) and find the code for the colour you want. Then sub your new colour code into the line below the selection key in the theme file, replacing the old hex colour code.
Save the modified theme file and it should work straight away.
EDIT
Install PackageResourceViewer plugin using package control. Open the command palette with ⌘⇧P (for windows/linux CtrlShiftP) and type prv
to get the PackageResourceViewer options. Choose Open Resource >>Theme- YourTheme >> and edit your theme file
Solution 2
Tony Vincent's answer is excellent, and I would also add that if changing the selection color makes the selected text difficult to read, selectionForeground is the key to change. For example:
<key>selectionForeground</key>
<string>#000000</string>
Solution 3
With the new .sublime-color-scheme
format, it's a global setting key named line_highlight
e.g.
{
"name": "My colour scheme",
"globals":
{
"background": "rgb(0, 0, 0)",
"foreground": "#aaaaaa",
"caret": "red",
"line_highlight": "#222222"
},
}
erdembayar
Updated on July 09, 2022Comments
-
erdembayar almost 2 years
How can I change the default highlight colour in Sublime Text 3? I used to know how find a highlight key in one of the theme files in ST2 but things changed quite on ST3. Are they in the library somewhere? "Preference >> Browse Package" is almost empty.
-
erdembayar almost 8 yearsWhere is that theme file? Above was true for Sublime 2. But I don't see theme files under "Preference >> Browse Package"
-
erdembayar almost 8 yearsHere is little bit correction. PackageResourceViewer >> Open Resource >>Color Scheme >> Monokai (This is my case) In my case "Extract Package" show neither "Theme" nor "Color Scheme". Thanks for your help.
-
Damien over 7 yearsI would also add
findHighlight
andfindHighlightForeground
-
Eight-Bit Guru about 7 yearsIn my S3 install these keys did not exist in the theme I use, so they had to be added to the same [settings] block as the selection key.
-
Joel Mellon almost 7 yearsThanks for the notes on editing the theme file with PackageResourceViewer.
-
LarsH about 6 yearsIn my case (ST 3.0 build 3143) it was
PackageResourceViewer >> Open Resource >> Color Scheme - Default >> Monokai.tmTheme
. Thanks, this was helpful. -
alper over 4 yearsWhile changing the backgorund highlight color, is it also possible to change the highlighted text's color such as into black? @Tony Vincent
-
Pynchia about 4 yearsWhere? None of the answers give a clear picture on how to access the mentioned settings
-
geoidesic about 4 yearsI don't know. Can't recall. I've moved on from Sublime because it was becoming difficult. VsCode does a better job all around.
-
Pynchia about 4 yearsYes of course. Changing the selection colour would be nice though
-
Szabolcs Páll almost 4 yearsMac: ~/Library/Application Support/Sublime Text 3/Packages/User/Monokai.sublime-color-scheme Windows: C:\Users\<user>\AppData\Roaming\Sublime Text 3\Packages\User\Monokai.sublime-color-scheme forum.sublimetext.com/t/…
-
Tim John over 3 years@alper Yes. See the answer by user2616155