简体   繁体   中英

How do I set custom HTML tag highlighting in a Sublime Text 3 theme?

I modified the existing ST3 theme file so that the id tag attribute will be highlighted with a specific color format, and it works perfectly:

<dict>
  <key>name</key>
  <string>CSS: #id</string>
  <key>scope</key>
  <string>entity.other.attribute-name.id.html</string>
  <key>settings</key>
  <dict>
    <key>fontStyle</key>
    <string></string>
    <key>foreground</key>
    <string>#99ff00</string>
    <key>background</key>
    <string>#0066ff</string>
  </dict>
</dict>

The problem is that I also want to have specific highlighting for the "class" , "style" and "name" attributes (ideally each with a different color). But simply changing the entity.other.attribute-name string does not highlight the specific text inside the tags. My tag attributes are set to default as green color already, and that works also:

<dict>
  <key>name</key>
  <string>Tag attribute</string>
  <key>scope</key>
  <string>entity.other.attribute-name</string>
  <key>settings</key>
  <dict>
    <key>fontStyle</key>
    <string></string>
    <key>foreground</key>
    <string>#A6E22E</string>
  </dict>
</dict>

How can I change tag attributes other than "id"? I would like "class" , "style" and "name" attributes to also have a back highlight just like "id" does, but so far, only "id" gets highlighted no matter what I've tried. What do I need to change? Thanks!

您可以使用entity.other.attribute-name.html定位它们

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM