Sublime Forum

How to customise theme?

#1

Hi there,

I would like to customise a personal syntax theme specific for C++.

This is the links I referenced:

https://www.sublimetext.com/docs/3/scope_naming.html

https://www.sublimetext.com/docs/3/color_schemes.html

The only question or problem left is, is that possible to set different colors for the class and the member function? Please take the following as an example:

void A::func() {}

A is the name of a class. I prefer to set “A” be the color green and “func” be the color red. According to the references, seems like “A::” will be considered as a part of the function definition and hence apply the same color as “func”.

0 Likes

#2

Your syntax definition should parse the class name separately and give it a seperate scope name. Then in your color scheme you reference that scope name and give it a different color. Note that scopes can be nested.

0 Likes

#4

@nutjob2 how to parse class names? could you show me one example or some reference documents?

0 Likes

#5

It’s all in Syntax Definitions.

0 Likes

#6

@nutjob2 thanks a lot. :slight_smile:

0 Likes