How to modify Sublime Text 3 color scheme file "filename.tmTheme" to apply background color to all occurrences of a matching text when double click? - sublimetext3

I think my question itself is quite descriptive and clear to understand what I require.
Actually, I want to apply background color to all occurrences of a matching text when I double click a text or variable.
I surfed entire Internet by Googling tremendously but couldn't find any property that can be used in my case. So that's why I am asking here. My last hope is STO.
What needs to be added or modify in my Sublime Text 3 color scheme file, e. g. "filename.tmTheme"?
I am having ST3 Version 3.2.2, Build 3211.
In given screenshot, you can see that matching occurrences ($ch in this case) are highlighted with yellow border. I want them to be in yellow background color like Dreamweaver does. Any chance?
My current settings in color scheme file:
<key>settings</key>
<dict>
<key>background</key>
<string>#fff</string>
<key>bracketContentsForeground</key>
<string>#f00</string>
<key>bracketContentsOptions</key>
<string>foreground underline</string>
<key>bracketsForeground</key>
<string>#f00</string>
<key>bracketsOptions</key>
<string>foreground underline</string>
<key>caret</key>
<string>#000</string>
<key>foreground</key>
<string>#000</string>
<key>gutter</key>
<string>#f2f2f2</string>
<key>gutterForeground</key>
<string>#999</string>
<key>highlight</key>
<string>#ff0</string>
<key>invisibles</key>
<string>#999</string>
<key>lineHighlight</key>
<string>#e8e8ff</string>
<key>selection</key>
<string>#0078d7</string>
<key>selectionBorder</key>
<string>#0078d7</string>
<key>selectionBorderWidth</key>
<string>2</string>
<key>selectionCornerStyle</key>
<string>square</string>
<key>selectionForeground</key>
<string>#fff</string>
<key>tagsForeground</key>
<string>#f00</string>
<key>tagsOptions</key>
<string>foreground underline</string>
</dict>

Related

Sublime Text 3 - how to remove red background

How to remove that Red background in Sublime. There is some slash in that line "/" when I remove that slash red background disappears. But how do I remove that red background permanently
just providing more information on this in case someone else looks into this. As mention above, you would need to edit the XML file associated to the color scheme you're using. If you're using a theme from package control you most likely would need to utilize PackageResourceViewer to open the XML file.
Once you've located the file, you would simply need to comment out the background values for the Invalid key.
For example refer to the snippet below:
<dict>
<key>name</key>
<string>Invalid</string>
<key>scope</key>
<string>invalid</string>
<key>settings</key>
<dict>
<!--key>background</key-->
<!--string>#ec5f67</string-->
<key>foreground</key>
<string>#ffffff</string>
</dict>
</dict>
This way you can maintain the syntax colors and suppress the annoying red highlight/background when there is an invalid syntax.

How do I color the stippled underline in Sublime Text 3?

I have a plugin using the add_regions command to draw underlines for certain regions.
I also have a custom tmLanguage and tmTheme, so I can control font style/foreground color etc. for scopes I have set.
Now, I'm trying to get my underlines to be a specific color (and not the default white-ish ST3 color)... I know this is possible because the spellcheck in ST3 has a red squiggly underline.
I've poked at changing the scope/settings/keys etc. in my tmTheme and my plugin's add_regions command, but nothing seems to stick.
Any direction would be very helpful!
You can simply set up a dummy scope in your tmTheme file with the foreground setting valued to the color you want your underline to be. Then pass in that scope name to the add_regions function call.
Example for yellow underline...
In the tmTheme file:
...
<dict>
<key>name</key>
<string>Yellow Underline</string>
<key>scope</key>
<string>underline.yellow.text</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#FFFF00</string>
</dict>
</dict>
...
In your plugin:
# ...
# set regions variable above
view.add_regions('key', regions, 'underline.yellow.text', '', sublime.DRAW_STIPPLED_UNDERLINE | sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE)
# ...
Ta-da! You should have yellow underlines now :)

Changing font for keywords only in Sublime Text 3 [duplicate]

Apologies if this has already been answered but I couldn't find any duplicates.
Is it possible to set font sizes on a per-token basis in Sublime Text 2? For example, all 'function' tokens would be size 10 whereas 'functionName' would be size 30? I've put together a rough mock-up of what I want to achieve:
The motivation here is to make it easier for you to focus on the important parts of your code - especially when skimming. I would suspect that such a thing should be possible given that, by default, ST2 already applies different fonts to different tokens (e.g. 'var' vs. 'c = a;' in switchVars()).
If it is not a feature, does ST2 provide the ability to implement this as a plugin? Thanks a lot!
Unfortunately, this is not possible, as there are no directives in the API or in color schemes for dealing with font size at that level of granularity.
However, it is possible to provide additional highlighting to your color scheme (.tmTheme file) so that function definitions stand out. It looks like you're using Monokai, so open Packages/Color Scheme - Default/Monokai.tmTheme and add the following to the end, just before the final </array>:
<dict>
<key>name</key>
<string>Function definition</string>
<key>scope</key>
<string>meta.function</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#000080</string>
</dict>
</dict>
This will highlight your function definition lines in a dark blue:
It also works for alternate function definition syntaxes:
Good luck!

Changing sublime text 3 html tag enclosure colors

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.
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>

how to edit and change only "function" and "class" keyword to bold in sublime-text-2?

i have searched through search engine and didnt find my solution for changing only the "function" and "class" keyword to bold in sublime text 2(especially for php)
all i know is how to change all text/code to bold is by adding the user settings
font_options: ["bold"]
but i dont know how to change only specific keyword to become bold.
so the question is :
- how to edit sublime-text-2 so it displays keyword "function" and "class" to bold
edited
whenn i change the font_options to ==> font_options: ["bold"]
ST2 displays function and class keyword in italic, then i tried to install ST2 in windows and it displays function and class keyword in italic too.
So i copy the theme xml file from windows to my ubuntu and nothing happen when in normal font , still the same, no italic/bold keywords , just displaying different colors for each keyword
is this normal thing? my main install ST2 is in ubuntu 12.04 64 bit LTS
Open your theme file (<sublime text 2 config folder>/Packages/Color Schemes - Default/themename.tmTheme) and change this key:
<dict>
<key>name</key>
<string>Class name</string>
<key>scope</key>
<string>entity.name.class</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>underline</string> <!-- This thing -->
<key>foreground</key>
<string>#69D2E7</string>
</dict>
</dict>
Answer copied from ST Forum:
For bold (or, similarly, for italic) to work you need:
A color scheme that uses bold.
A monospace font.
A font that includes bold weight.

Resources