Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 3 Tab Color Based on File Type?

Tags:

sublimetext3

I have many similarly named files in my project, e.g. 'items.create.html', 'items.create.controller.js' and 'items.create.scss', and I want to easily find the right one by simply color-coding tabs (maybe even putting custom icons?) based on the file type.

Is that possible?

Is there a package I can install? Maybe hack it on my own?

like image 673
Eli Avatar asked Apr 04 '15 14:04

Eli


People also ask

How do I change the color scheme in Sublime Text 3?

Sublime Text 3 has a number of pre-installed themes that can be enabled by clicking on “Preferences” in the top bar, then clicking “Color Scheme”. Click on “Preferences” in the top bar, then click “Color Scheme”.

How do I find the color code in Sublime Text?

Once installed, go to the Command Palette in Sublime Text by hitting the Command + Shift + P or (Ctrl + Shift + P for Windows). Then search for ColorPicker. Or you can do it faster just by pressing Command + Shift + C. This will open the native color picker from your OS.

What is the default sublime color scheme?

Sublime Text → Preferences -> Colour Scheme… and select Mariana ( Colour Scheme — Default ). This is the default colour scheme available in latest build and it gives an apt colour to the classes, functions and for syntax highlighting supremely.


2 Answers

It is not perfect but the best "solution" I've found so far is to add a Syntax specific setting to change the color scheme for every filetype in which you want to have a different tab color. This is not a good solution as it also changes the background color for each filetype, so I hope someone finds a better answer.

Note 1: to add a synyax specific setting open a file (for example a .css file) and then use the menu Preferences > Settings-more > Syntax-specific. This way the settings you add will only be set for css files.

Note 2: in addition to the default color schemes, you can create your own and change the background property as you like.

Example screenshot:

Sublime text tab color based on file types example

Example settings: For javascript:

{
    "color_scheme": "Packages/User/SublimeLinter/Zenburnesque (SL).tmTheme",
}

For css:

{
    "color_scheme": "Packages/User/SublimeLinter/Dawn (SL).tmTheme"
}

For html:

{
    "color_scheme": "Packages/User/SublimeLinter/Cobalt (SL).tmTheme"
}
like image 183
sergioFC Avatar answered Oct 02 '22 04:10

sergioFC


Possible

The following resources will help, no packages needed

  1. Change Color Scheme Depending On File Type Open

    At the very least you can just use different themes based on the file type. Or you can duplicate your favorite theme and modify it to look slightly different.

  2. How do I change the background tab color? It's too subtle

    This resource only talks about editing the default template, but I don't see why this can't be done to any other theme (might take a some tinkering)

like image 42
HandyDan Avatar answered Oct 02 '22 02:10

HandyDan