Home Download Buy Blog Forum Support

Changing foreground color of (mouse) selected region

Changing foreground color of (mouse) selected region

Postby aroberge on Mon Oct 07, 2013 2:33 am

In some schemes, the highlighting (background) color when selecting a region with a mouse is very similar to that of the foreground text, making such text impossible to read. By contrast, when searching for a given string, the result is highlighted in such a way that both the foreground and background colors are set in high contrast.

Is is possible to have a theme defined so that the highlighted region (when selected by a mouse) will be similar to that resulting from a search?
aroberge
 
Posts: 21
Joined: Sat Feb 12, 2011 1:03 am

Re: Changing foreground color of (mouse) selected region

Postby aroberge on Mon Oct 07, 2013 10:32 pm

Alternatively, if I could find a way to assign a key to do the following:
* after selecting some text do:
1. ctrl-e
2. mouse-click before the text selection in main window (to give it focus again)
3. F3
It would accomplish what I'm hoping to do. I gather that macros do not deal with mouse clicks...
aroberge
 
Posts: 21
Joined: Sat Feb 12, 2011 1:03 am

Re: Changing foreground color of (mouse) selected region

Postby skuroda on Tue Oct 08, 2013 3:22 am

Believe you can edit your color scheme file to change the mouse selected region. One of the keys in that file is "selection" followed by a color specified in hex.
skuroda
 
Posts: 685
Joined: Fri Oct 05, 2012 8:11 am

Re: Changing foreground color of (mouse) selected region

Postby aroberge on Tue Oct 08, 2013 4:38 am

skuroda wrote:Believe you can edit your color scheme file to change the mouse selected region. One of the keys in that file is "selection" followed by a color specified in hex.

Yes, I have already mentioned that in my first post. The problem I have is that any decent looking highlighting color ends up being too close to the foreground color of some scope/keyword/etc. When selecting a word through a search, the foreground color gets altered as well, thereby ensuring proper contrast.
aroberge
 
Posts: 21
Joined: Sat Feb 12, 2011 1:03 am

Re: Changing foreground color of (mouse) selected region

Postby lord-lele on Mon Oct 14, 2013 8:42 am

Open your theme files (or create your own) and find this string:

<key>selection</key>
<string>#ba5000</string> <!-- your color will be different -->

Just below add this:

<key>selectionForeground</key>
<string>#FFFFFF</string> <!-- or whatever color you want -->

Tested in Sublime Text 3.
lord-lele
 
Posts: 2
Joined: Wed Mar 20, 2013 11:33 am

Re: Changing foreground color of (mouse) selected region

Postby aroberge on Tue Oct 15, 2013 9:40 pm

selectionForeground worked as well for SublimeText 2. Thanks! :D
aroberge
 
Posts: 21
Joined: Sat Feb 12, 2011 1:03 am

Re: Changing foreground color of (mouse) selected region

Postby EricBeaudoin on Sat Oct 26, 2013 5:23 pm

I'm trying to do something similar i.e. changing the foreground color for the selected text but only for the comments. I've tried to edit the comment section from Solorized (Dark).thTheme like this:

Code: Select all
<dict>
   <key>name</key>
   <string>Comment</string>
   <key>scope</key>
   <string>comment</string>
   <key>settings</key>
   <dict>
      <key>fontStyle</key>
      <string></string>
      <key>foreground</key>
      <string>#586E75</string>
      <key>selectionForeground</key>
      <string>#2AA198</string>
   </dict>
</dict>


But the selectionForeground appears to be ignored in this case. I'm using Sublime Text 3.

Is there any way to achieve this?
EricBeaudoin
 
Posts: 1
Joined: Sat Oct 26, 2013 4:57 pm


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Orlmente, sapphirehamster, Yahoo [Bot] and 37 guests