Change highlight colour in Sublime Text 3? - text

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.

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

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>

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

Related

Remove text highlighted rounded corner in Sublime text

I don't like the rounded corner on the highlighted text in sublime text 3. How can I disable this feature from the sublime text?
The rounded corners of selected text in Sublime Text is controlled by the selection_corner_style global setting of your active color scheme. In order to change it, there are basically two ways. You can follow any one.
If you have the PackageDev package installed, then you can choose PackageDev: Edit Current Color Scheme from the command palette. This will open a split window layout with the default color scheme on your right group & your User version on the left group. Add selection_corner_style: "square" to the existing global values and save the file. This will get rid of the rounded corners and give it sharp corners instead.
The second (and the laborious way if you don't want to install a package) is to follow these steps :-
Find out your active color scheme name from the color_scheme setting from your User preferences (go to Preferences: Settings from the command palette).
Create a file by that exact same name in the User directory (Preferences -> Browse Packages ... from the main menu).
Paste the following
{
"variables": {
// Define variables here
},
"globals": {
"selection_corner_style": "square",
},
"rules": [
]
}
Save the file.
Note: If you are using a custom color scheme and don't define the selection_corner_style, the default value of this key is round & it will still apply.

Change VS Code Command Palette highlight color [duplicate]

Is it possible to change the color for quick picker selected option via settings?
To keep your current theme and change just this color, find "Workbench: Color Customizations" in your settings and click "edit in settings.json", and add the following to the user settings on the right side of the screen:
"workbench.colorCustomizations": {
"list.focusBackground": "#CCCCCC"
},
You can replace it with any color you'd like.
You can install or download a new theme via:
Files -> Preferences -> Color Theme
Or you can create your own theme from scratch or reuse of an existing one with the VSCE tool:
https://code.visualstudio.com/docs/extensions/themes-snippets-colorizers
Or you can simply find the theme in the folder::
\Microsoft VS Code\resources\app\extensions
Where the colors are saved in JSON files.
The defaults are in the:
\theme-defaults\themese
Here is the Visual Studio Light (light_defaults.json), where I just changed the list.hoverBackground color to some hideous purple:
{
"$schema": "vscode://schemas/color-theme",
"name": "Light Default Colors",
"colors": {
"editor.background": "#FFFFFF",
"editor.foreground": "#000000",
"editor.inactiveSelectionBackground": "#CCCCCC",
"editorIndentGuide.background": "#D3D3D3",
"editorIndentGuide.activeBackground": "#939393",
"editor.selectionHighlightBackground": "#FFFFE0",
"editorSuggestWidget.background": "#F3F3F3",
"activityBarBadge.background": "#007ACC",
"sideBarTitle.foreground": "#6F6F6F",
"list.hoverBackground": "#FF00FF",
"input.placeholderForeground": "#ADADAD"
}
}
--- update ---
Different themes use more or fewer options depending on how much they vary from the default color. Missing ones can be added too. The ones you are looking for here are called list.hoverBackground and list.highlightForeground and they are pretty general affecting lots of different areas in VS Code.
"list.hoverBackground": "#ffffff",
"list.highlightForeground": "#bbdaff",
You really asked two questions: hover color in the question title and selected option color in the first sentence. Those are handled in two different ways:
"workbench.colorCustomizations": {
"quickInputList.focusBackground": "#ff0000", // the selected option color
"list.hoverBackground": "#ff0000" // the hover color
}
The selected option is for when up/down arrow in the Command Palette/Quick Input and the hover is for a mouse hover.
There are 2 variables that I know of associated with Quick Picker. Neither seem related to a hover color but they may be. The 2 are:
pickerGroup.border: Quick picker (Quick Open) color for grouping borders.
pickerGroup.foreground: Quick picker (Quick Open) color for grouping labels.
Hope one of these helps you. Try them in the settings file.

how do i change the font in sublime text search bar / CTRL+ P key

I want to change the font of the search bar and also the results there, because I can't see it clearly
I saw your question still hanging so I installed Sublime on Debian to try to configure it.
First of all, you can read how to customize Sublime at here. And the part of interface you want to configure is called quick_panel, specifically class quick_panel_label.
At the end of theme configuration page, there is an example of customization file.
I don't know what theme are you using, but if you are using Default theme, you should create new file called Default.sublime-theme and place it in Packages/User/. You can quickly find that path by menu of sublime, Preferences -> Browse packages... .
Content of Default.sublime-theme should be:
[
{
"class": "quick_panel_label",
"font.size": 25
}
]
where font.size represent font size of menu you are trying to customize.
P.S.
If you don't know the name of the file your theme is using, from menu choose Preferences -> Theme... and all themes should be listed with their .sublime-theme file.
For example, I customized Arc Dark theme.
I hope this works for you.

Editing a Project's Tab Colors

I work on 3 different repositories at the same time and I want to have a sublime project for each with the same theme except with different tab colors so I can quickly identify which is which. I am trying to use darkside-contrast from Dayle Color Schemes.
I opened up the darkside-contrast.tmTheme and it is an xml and I tried editing all of the colors but cannot figure out which one controls the tab colors.
I see that there are some settings like sheet_container_control that may be useful, but I am not sure what to do with this or where I can find a full list of parameters in a sublime theme. Do I edit the tmTheme xml or do I need some sort of JSON file to specify tab color? Can I use the sublime-project file to specify this for each project?
I would also like to shrink the tab heights. Any pointers would be great. Thanks
For project multitasking, I'd suggest you simply add each project folder on a separate sublime window sidebar and switch between them. This way each indexed project will be a breeze to browse through (CTRL+T or CMD+T on mac) without any unwanted files from other projects.
Related topic if you wish to check (it's not limited to just Monokai theme but also shows how to create your own theme file with the specific setting you wish to tweak): How to change Sublime Text 2 selected tab color
For reduced tab height, you could use Afterglow's theme small tabs JSON settings (biggest size is set by default, add a comma at the end of true if more settings are listed):
{
"tabs_small": true
}

color caret in sublime text 3

I would like my caret in sublime text 3 to have a custom hex color attached to it so it is easier to see. Is there a plug in that I can download to achieve this feature or do I haft to edit the theme file? If I need to edit the theme file how should I do that and achieve a successful result.
SublimeText theme files are XML, so you can just find and edit the following chunk
<key>caret</key>
<string>#FFFFFF</string> # change this to the color you want
Otherwise, if you prefer a more GUI approach you can have a look at TMTheme Editor

Resources