Sublime Forum

Color scheme help

#1

I customized my own color scheme to better match what I was used to with other editors. I prefer light background + dark text, and had certain other preferences (again, more to do with familiarity than anything). I’m not that familiar with the color scheme structure and how it all works and ties in together in Sublime, so I’ve hit a minor issue I’d like to resolve. I’m sure it’s possible, I just don’t know how.

(As an aside, I’m a PHP developer, so that’s all I care about here)

Sublime automatically picked up on phpdoc-style comments, which was nice. Thing is, it picks up php symbols inside the comments and styles them according to the symbol styling scheme. Here’s an example

“private” is being styled according to the keyword styling I’ve applied (you can see it in use right below the comment), making it bold and blue. It is italicized (which is only done for comments), so the italic styling is being applied but not overriding the bold styling. It doesn’t appear to make a difference what order the XML elements are in inside the file (I tried moving the comments definition to the end of the file, figuring it might override earlier definitions).

Here is my comment styling definition - what should I change to get the symbols inside comments to style as a regular comment? Is it possible? Note that I’d still like “access”, “var”, etc. styled as they are now (blue, italic, not bold).

<dict> <key>name</key> <string>Comment</string> <key>scope</key> <string>comment</string> <key>settings</key> <dict> <key>fontStyle</key> <string>italic</string> <key>foreground</key> <string>#488C03</string> </dict> </dict>

Further, is there any documentation I can refer to that describes all of the color scheme options? I think I’m looking for a breakdown of all the scopes available, as well as any settings (e.g. selection, lineHighlight, etc.), as that would help me know what I can style exactly. I just copied an existing scheme and tweaked it to my tastes, so I’m sure there’s a ton more options available that I just don’t even know about.

0 Likes

#2

Colorschemes style based on selectors. You can view what selectors are applied to a specific element by using the show_scope_name. The keybinding defers between operation systems so just to a quick find in your Default Keybindings File. When you press that keybinding, it will list all the selectors that apply to where your cursor is in the document.

tmThemes work kind of like css… except the styling is added in reverse. Try moving the comments up toward the top. It should fix your problem.

0 Likes

#3

Thanks for the tip!

Unfortunately, moving the comments declaration up didn’t do anything to help.

Your tip on finding the scope helped immensely, however. I found that it is:

text.html.basic source.php.embedded.block.html comment.block.documentation.phpdoc.php storage.modifier.php

Using this, I tried to modify the comments declaration to scope “comments, comments storage.modifier.php” and this changed the color, but left the keyword bolded (despite having a fontStyle defined in this declaration of italic - I didn’t know how to tell it to use normal font weight).

Ultimately I changed the ‘storage’ declaration to

<string>storage - comment storage.modifier.php</string>

This resolves the issue perfectly. Thanks!

0 Likes