Sublime Forum

Question on changing some color scheme items in the .tmTheme for Python

#1

Hi guys, I have found a couple threads on similar issues and a reference file (docs.sublimetext.info/en/latest/reference/color_aschemes.html#selection) but I still have some questions about how to make some specific changes to my theme, by editing the tmTheme file. Specifically I’m working in Python right now.

Things I’d like to change:
1. All brackets and parenthesis to a certain color (not just brackets my cursor is within).
2. Basic operators like +, =, -, /, distinct from keywords like from, if, for, while. I have found how to change key phrases like import, from, if, while etc. but when I change them, the operators are also changing and I would like to change them separately from each other.
3. Somewhat similar to question 2., I’ve noticed that the keyword open, e.g. open(‘file.txt’, ‘r’) is changing color when I change the color for variables. I feel as if open should not be the same color as variables so if there is a way to separate open from variables that would be great.

In case it is helpful, here’s my tmTheme file on pastebin: http://pastebin.com/xtZSELnv

Thank you very much :slightly_smiling:

0 Likes

#2
  1. Target the punctuation scope. That will yield a few additional results, but will also include all parentheses of languages with a syntax definiition that supports this. You can refine further from that.
  2. Target keyword.operator.
  3. Target support.function (or just support). This is not a “variable” scope btw, so I don’t understand how changing the color of “variables” in your color scheme would change that color. It doesn’t select both of these in the same selector either.

By the way, you can make ST report the scope of a specific character position with ctrl+alt+shift+p.

1 Like

#3

Wow, that is really good to know, thank you :smiley:

0 Likes