Home Download Buy Blog Forum Support

Setting a different highlight in ST3

Setting a different highlight in ST3

Postby noit on Mon Nov 18, 2013 7:12 am

Hi, I'm new to coding and just got on board with ST3 and its package system.

Basically, I really like a colour scheme with Python or JS but totally dislike its colouring with PHP.
Could it be that there's an easy way or at least a safe one to swap the colour highlighting of PHP to one used in another language?
If not I'm just going to swap some files and see how messy it gets. :|

The theme is Tomorrow Night for those who are curious
noit
 
Posts: 3
Joined: Mon Nov 18, 2013 6:30 am

Re: Setting a different highlight in ST3

Postby iamntz on Mon Nov 18, 2013 8:18 am

If you edit the theme, you will see that there are some generic scopes:
Code: Select all
<dict>
   <key>name</key>
   <string>Control Structures</string>
   <key>scope</key>
   <string>keyword.control</string>
   <key>settings</key>
   <dict>
      <key>foreground</key>
      <string>#64d9ee</string>
   </dict>
</dict>

(used for, let's say if statements; notice scope key: keyword.control)

You can then add another block, only for php:

Code: Select all
<dict>
   <key>name</key>
   <string>Control Structures</string>
   <key>scope</key>
   <string>keyword.control.php</string>
   <key>settings</key>
   <dict>
      <key>foreground</key>
      <string>#00FF00</string>
      <key>background</key>
      <string>#CC0000</string>
   </dict>
</dict>

(notice the .php in the scope key)

What you have to do is to add some custom scopes. The shortcut you will need is ctrl+alt+shift+p and you will see in the statusbar current scope.

Make sense?
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Setting a different highlight in ST3

Postby qgates on Wed Nov 20, 2013 5:55 am

@iamntz I think he's asking whether he can set the colour scheme per-language.

@OP... If so, the answer is yes. With a PHP file open (or PHP syntax set for the current buffer) go to Preferences -> Settings - More -> Syntax Specific - User. You'll likely get a new preferences file. Add the following:

Code: Select all
{
   "color_scheme": "Packages/Color Scheme - Default/<colour scheme name>.tmTheme"
}


Save and close. Incidentally, almost any settings can be made per-syntax/language this way.

Are you using the older "tomorrow night" or the newer "base16-tomorrow dark" theme by the way?
qgates
 
Posts: 224
Joined: Mon Nov 05, 2012 4:33 pm

Re: Setting a different highlight in ST3

Postby noit on Sat Dec 07, 2013 5:17 pm

the old one, why?
noit
 
Posts: 3
Joined: Mon Nov 18, 2013 6:30 am

Re: Setting a different highlight in ST3

Postby noit on Sat Dec 07, 2013 5:35 pm

iamntz wrote:If you edit the theme, you will see that there are some generic scopes:
Code: Select all
<dict>
   <key>name</key>
   <string>Control Structures</string>
   <key>scope</key>
   <string>keyword.control</string>
   <key>settings</key>
   <dict>
      <key>foreground</key>
      <string>#64d9ee</string>
   </dict>
</dict>

(used for, let's say if statements; notice scope key: keyword.control)

You can then add another block, only for php:

Code: Select all
<dict>
   <key>name</key>
   <string>Control Structures</string>
   <key>scope</key>
   <string>keyword.control.php</string>
   <key>settings</key>
   <dict>
      <key>foreground</key>
      <string>#00FF00</string>
      <key>background</key>
      <string>#CC0000</string>
   </dict>
</dict>

(notice the .php in the scope key)

What you have to do is to add some custom scopes. The shortcut you will need is ctrl+alt+shift+p and you will see in the statusbar current scope.

Make sense?


Thanks it worked at last. I had to use scopehunter to find out that the correct scope is variable.other.php not just variable.php
noit
 
Posts: 3
Joined: Mon Nov 18, 2013 6:30 am


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 47 guests