Using an existing Sublime 2 color scheme, is there a way to tweak the background color selectively for eg. .js files only? Many thanks!
You have to modify your .tmTheme
color scheme plist
. You can find it with menu Preferences/Browse Packages...
, Color Scheme - Default
directory.
You should add something like this:
<dict>
<key>scope</key>
<string>source.js</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#000000</string>
</dict>
</dict>
as a child of the settings array (of course you have to change #000000 with your color code).
I was actually trying to change the background color for text files and was wondering how Riccardo figured out how to use source.js as the value for the scope.
You need to locate the .tmLanguage file of the file type you are trying to change, which is "Plain text.tmLanguage" for text files. Then look for the scopeName key and use the value for that. This is from my "Plain text.tmLanguage" file:
<key>scopeName</key>
<string>text.plain</string>
So, for example, to change the foreground color for text files to lime:
<dict>
<key>scope</key>
<string>text.plain</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#00FF00</string>
</dict>
</dict>
For me I wanted to add color scheme to .conf (apache) file
opend myFile.conf in Sublime
Tools > Command Pallet > Set Syntax : groovy
I chose "groovy" you can choose which ever one you want.