Sublime Forum

How do I make my own syntax highlighting colour scheme?

#1

Hi,

I code in Unity, which uses a variant of javascript. I would like to add syntax colouring for unity commands. How do I do this? Thanks!

0 Likes

#2

You need to add a new .tmLanguage file. Check the packages folder to see the implementation of other languages. Since sublime uses textmate syntax files, you could potentially find a unity syntax file and save yourself the effort.

0 Likes

#3

I use Sublime for JSFL (Java Script Flash) and found that
I could get sublime text to recognize .jsfl files as JavaScript and hilite/color code ect appropriately by doing this:

1.)in sublime text menus, go to Prefernces/Browse Packages… to open your packages directory
2.) in the packages directory open the JavaScript folder
3.)in the JavaScritp folder select JavaScript.tmLanguage and open in SublimeText
4.) near the top of this file look for the chunk that lists the extensions it recognizes:

<key>fileTypes</key> <array> <string>js</string> <string>htc</string> <string>jsx</string>

5.) add jsfl to the list and save

now it will recognize .jsfl files as javascript

if unity code has its own extension (.unity or whatever) simply add it similarly
it won’t recognize every unique unity syntax, but all the shared Javascript syntax will be good to go.

0 Likes

HTML Syntax Highlighting for different file extensions