Sublime Forum

Custom conditional theming based on attributes

#1

Hi. I see that in theme files, there are some conditional constructs available,
for example:

    "class": "tab_label",
     "parents": [{"class": "tab_control", "attributes": ["selected"]}],
     "attributes": ["dirty"],
     "settings": ["highlight_modified_tabs"],

I played around with “settings”, and it seems to honor any user-defined key here.
however, I need to define conditions based on the current view.
it seems “attributes” does this, since “dirty”, “selected” refer to views

my questions are :

  1. what attributes are available ?
  2. can I define and set my own attributes programmatically ?
0 Likes

#2

Considering that themes define the appearance of the entire application, I don’t think they consider anything but the global Preferences.sublime-settings settings. You can, however, change these programmatically with a plugin depending on what kind of view is active, if you need to.

Documentation for theming is extremely lacking and I can not tell you what kind of attributes are available.

0 Likes

#3

well, as I said before, “dirty” and “selected” are NOT global, so it should be possible…

0 Likes

#4

These kind of attributes are very likely hard-coded and provided by Sublime Text itself. I was mainly referring to the settings bit.

0 Likes

#5

anyway I could ask the developer(s) ?

0 Likes

#6

You can only hope they read this thread (one of them is quite active now) and provide an answer. Or queue them an email (I don’t really recommend that).

Maybe they will put out some documentation eventually. I’ve written docs before and I know it’s hard work.

0 Likes