2016-04-21 105 views
2

我知道如何改變javascript和CSS的突出顯示顏色。我添加到我的積極tm.Theme文件<array></array>之間的字符串:Sublime Text 3中的不同突出顯示JS和CSS

<dict> 

    <key>name</key> 

    <string>Embedded source</string> 

    <key>scope</key> 

    <string>text source, string.unquoted</string> 

    <key>settings</key> 

    <dict> 

    <key>background</key> 

    <string>#804A7D99</string> 

    </dict> 

    </dict> 

結果:

Violet background

但如何讓JS的背景和CSS不同,這是更方便在小地圖上引導?例如:

JS - 藍色

Blue background

CSS - 綠

Green background

感謝。

+0

我注意到你在過去幾天一直在尋找色彩方案。你正在開發一個版本還是隻是你的個人設置? – Enteleform

+0

另外 - 請提供[** Gist **](https://gist.github.com/)或[** PasteBin **](http://pastebin.com/)代碼樣本與您的問題進行測試解決方案更易於回答問題。 – Enteleform

回答

2

enter image description here

 

包括在你的tmTheme文件來處理混合JSCSS,& HTML下面的代碼。

<dict> 
     <key>name</key> 
     <string>JS_Source</string> 
     <key>scope</key> 
     <string>source.js.embedded.html</string> 
     <key>settings</key> 
     <dict> 
      <key>background</key> 
      <string>#2D6A73</string> 
      <key>foreground</key> 
      <string>#7B91B9</string> 
     </dict> 
    </dict> 

    <dict> 
     <key>name</key> 
     <string>CSS_Source</string> 
     <key>scope</key> 
     <string>source.css.embedded.html, meta.attribute-with-value.style.html source.css</string> 
     <key>settings</key> 
     <dict> 
      <key>background</key> 
      <string>#2D7333</string> 
      <key>foreground</key> 
      <string>#7B91B9</string> 
     </dict> 
    </dict> 

    <dict> 
     <key>name</key> 
     <string>HTML_Text</string> 
     <key>scope</key> 
     <string>text.html</string> 
     <key>settings</key> 
     <dict> 
      <key>background</key> 
      <string>#783727</string> 
      <key>foreground</key> 
      <string>#7B91B9</string> 
     </dict> 
    </dict> 

 

正如在評論中提到由@KeithHall,使用範圍的:

CSS: source.css.embedded.html, meta.attribute-with-value.style.html source.css 
JS: source.js.embedded.html 

將允許您將這些自定義背景色適用於HTML語法,而不影響CSS & JS語法。

+2

請注意,這也會影響獨立css和js文件的背景顏色 - 您可以使用'source.css.embedded.html,meta.attribute-with-value.style.html source.css'範圍來僅影響css嵌入在html和'source.js.embedded.html'中只會影響嵌入到html中的js –

+1

@KeithHall:良好的調用!更新:) – Enteleform

+0

@KeithHall我可以在哪裏閱讀關於HTML/CSS/JS的所有範圍,除了source.css.embedded.html,meta.attribute-with-value.style.html source.css,text.html',由Sublime Text 3支持?謝謝! –

1

您可以將語言特定的崇高設置(例如js.sublime-settings)添加到Sublime Text 3/Data/Packages/User中,併爲此語言定義完全不同的配色方案(js)。

{ 
    "color_scheme": "my_js_specific_theme.tmTheme", 
} 

,或者你可以嘗試在你的.tmTheme如下:

<dict> 
    <key>scope</key> 
    <string>source.js</string> 
    <key>settings</key> 
    <dict> 
     <key>background</key> 
     <string>#000000</string> 
    </dict> 
</dict> 

更換#000000當然是有你的顏色代碼。