Changing sublime text 3 html tag enclosure colors

Deadly 提交于 2019-12-11 04:47:25

问题


I've been using this tool to set up my sublime text 3 color scheme to match the custom one that I made using the built in editor on coda 2:

http://tmtheme-editor.herokuapp.com/

This editor is great, but I'm having trouble changing the color of the < and > around html tags without changing the color of regular text elsewhere.

The following in my theme file changes the color of the text inside the < >.

<dict>
    <key>name</key>
    <string>Tag name</string>
    <key>scope</key>
    <string>entity.name.tag</string>
    <key>settings</key>
    <dict>
        <key>fontStyle</key>
        <string></string>
        <key>foreground</key>
        <string>#24549d</string>
    </dict>
</dict>

And the following seems to change all of the regular text in my file to black, as well as changing the < and > around html tags.

<dict>
    <key>name</key>
    <string>Normal Variable</string>
    <key>settings</key>
    <dict>
        <key>fontStyle</key>
        <string>bold</string>
        <key>foreground</key>
        <string>#000000</string>
    </dict>
</dict>

So using the above in my color scheme file results in my in html like this:

<p>I want this text to be black, and the full tag to be blue</p>

To have black a black < and > with blue p's and black text.

Changing the Normal Variable color to blue allows the full html tag to become blue, but has the side effect of also changing the text to blue, while I'd like the text to stay black.

Normal Variable also seems to have control over the color of the line numbers in sublime text 3, too.

Does anyone have experience with the sublime text 3 color scheme system, or know how to specifically target the < and > around html tags? Everything I seem to find through google relates to sublime text 2, and has a completely different looking system for setting the colors. A link to a resource explaining the different options for the color theme files would be great too, as long as it's for sublime text 3, and not sublime text 2.


回答1:


I'm the developer of the editor you mentioned.
The editor has a lot of shortcomings. I'm working on a new version that supports preview for different languages in my free time, but it's not finished yet.

In the meantime I can help you solve your problem. You should add this rule to your tmTheme file to target tag punctuations.

    <dict>
        <key>name</key>
        <string>Tag Punctuations</string>
        <key>scope</key>
        <string>punctuation.definition.tag.begin, punctuation.definition.tag.end</string>
        <key>settings</key>
        <dict>
            <key>foreground</key>
            <string>#FF0000</string>
        </dict>
    </dict>


来源:https://stackoverflow.com/questions/21323642/changing-sublime-text-3-html-tag-enclosure-colors

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!