erdembayar
erdembayar

Reputation: 623

Change highlight colour in Sublime Text 3?

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.

Upvotes: 45

Views: 41923

Answers (6)

johnrpenner
johnrpenner

Reputation: 355

changed the Sublime Text 3 Colour Scheme by doing the Following:

  1. Sublime Text > Settings > Customize Color Theme..

  2. in the Parallel Text window that comes up, this is what the Right-hand editor should be changed to:

    { "variables": { },

     // JRP Syntax Colours
     "globals":
     {
         "background":     "rgb(27, 43, 52)",
         "foreground":     "#ffffff",
         "caret":          "orange",
         "line_highlight": "#FFCC66", 
         "selectionForeground": "#FFCC66",
         "selection": "#A57A03",
         //"selection": "orange",
    
     }
    

    }

Upvotes: 0

ccpizza
ccpizza

Reputation: 31801

In Sublime4 you get an option available from the menu :

(macOS) Sublime TextSettingsCustomize Color Scheme
(windows/linux) PreferencesSettingsCustomize Color Scheme

in the override file that is automatically created add your color as #hex or named color:

{
  "globals": {
    "selection": "red"
  }
}

In the left panel you'll have a list of other keys and color variables that you can customize.

Upvotes: 0

rawat89
rawat89

Reputation: 21

Above solution worked great (re-posting solution from above since I don't have enough reputation to add comments and confirm solution). Now my sublime shows highlighted searches clearly, and additionally I can see the highlights on the mini-map (or maybe I never noticed minimap before, but at least it works well now).

I just added above code into the user defined settings ("Preferences" -> "Settings - Syntax Specific").

"name": "My colour scheme",
"globals":
{
    "background":     "rgb(0, 0, 0)",
    "foreground":     "#aaaaaa",
    "caret":          "red",
    "line_highlight": "#222222"
},

Upvotes: 0

Tony Vincent
Tony Vincent

Reputation: 14362

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

Upvotes: 52

geoidesic
geoidesic

Reputation: 5063

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"
    },
}

Upvotes: 7

user2616155
user2616155

Reputation: 348

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>

Upvotes: 17

Related Questions