Sublime Forum

Colour Scheme help please

#1

Hi, I am trying to get my head around how to add colour highlighting to three different sets of function names. I want to add it to an existing theme. I have been reading the Colour Schemes and Scope Naming documentation but as it’s my first time looking at it I’m finding it somewhat confusing! I saw mention somewhere of adding user tweaks to schemes without editing the original but I can’t find that now!

The highlighting only needs to apply on a single specific language (Papyrus - Skyrim). I’m wanting to add the highlighting to the MaterialMonokaiDark colour scheme.

I currently have the three lists of functions in a Notepad++ syntax highlighting xml file (at least I assume that’s what it is…):

https://pastebin.com/EV8qFnTb

Can someone please give me an ELI5 on how to do this?

0 Likes

#2

There is a short section how to customize a color scheme in the official documentation, and I can recommend a video channel https://www.youtube.com/user/nurdz/videos from a user of this forum who published some detailed and high quality videos about this topic over the last weeks (e.g. “How Sublime color schemes work”).

However, for your case you most likely need to create or adjust the corresponding syntax definition for that specific language first (unless there exists already one for it). This might be a bit more complicated, but there is also a section about it in the ST documentation.
What syntax are you currently using for your files?

1 Like

#3

Thanks very much for taking the time to reply. It’s a proprietary scripting language for Bethesda games. I am using SublimePapyrus for the syntax, but it doesn’t include function name highlighting (function calls, not declarations).

And thanks for the links, I’ll take a look at them this evening.

0 Likes

#4

Looks like that package uses the old .tmLanguage format for its syntax, but it can easily converted to a .sublime-syntax file via the Tools > Developer menu for better readibility. Then you could add a rule for the function names and give them an appropriate scope which will be highlighted by your color scheme, such as support.function. For that you need to replace the spaces in your function list from the Notepad++ file with pipes, to make it a valid Regex like so:

- match: '\b(Abs|Acos|Activate|Add|AddAchievement|etc)\b'
  scope: support.function.papyrus

The syntax has a pretty flat structure, so I guess this should already work quite well if appended to the main context.

0 Likes