HighlightWhitespaces icon indicating copy to clipboard operation
HighlightWhitespaces copied to clipboard

Change color

Open kathcode opened this issue 10 years ago • 2 comments

I need to change the highlight color, but don´t understand how you should do. I try two ways. { "highlight_whitespaces_space_highlight_scope_name": "#dedede", "highlight_whitespaces_tab_highlight_scope_name": "#dedede", "highlight_whitespaces_eol_highlight_scope_name": "#dedede", "highlight_whitespaces_mixed_highlight_scope_name": "#dedede" }

{ "highlight_whitespaces_space_highlight_scope_name": "comment", "highlight_whitespaces_tab_highlight_scope_name": "comment", "highlight_whitespaces_eol_highlight_scope_name": "comment", "highlight_whitespaces_mixed_highlight_scope_name": "comment" }

please help me, thanks

kathcode avatar Jul 06 '15 17:07 kathcode

@LeslieMeneses If you open the package using PackageResourceViewer(also a Sublime Package) you can open highlight_whitespace.py within it. If you change line 34, to "comment" from "invalid" it will change. You can also make it empty and turn the white spaces white. Unfortunately, I have no idea how to customize it beyond that.

DEFAULT_COLOR_SCOPE_NAME = "comment"
      or
DEFAULT_COLOR_SCOPE_NAME = ""

nimylian avatar Jul 22 '15 14:07 nimylian

Just figured out how to do this, it's a little convoluted...

Using PackageResourceViewer find the theme file you are using. I am using one of the default themes, Monokai.tmTheme, found in "Color Scheme - Default".

Open the file, scroll all the way to the bottom and insert the following piece of XML

<dict>
  <key>name</key>
  <string>Custom highlight color</string> <!-- Set the name you want here -->
  <key>scope</key>
  <string>custom.highlight.color</string> <!-- Set the id you want here -->
  <key>settings</key>
  <dict>
    <key>background</key>
    <string>#F93232</string> <!-- color goes here -->
    <key>fontStyle</key>
    <string></string>
    <key>foreground</key>
    <string>#F9F2CE</string> <!-- color goes here -->
  </dict>
</dict>

Save the changes.

Note: Found that snippet in the TrailingSpaces Package documentation, the package this one is forked from.

With that set, open the User Settings file of HighlightWhitespaces and add the following lines to it

{
   "highlight_whitespaces_space_highlight_scope_name": "custom.highlight.color",
   "highlight_whitespaces_tab_highlight_scope_name": "custom.highlight.color"
}

That should do it. You can even have different colors for spaces and tabs. Pretty cool. The only annoying part is that if you change color schemes you need to manually add the custom color to the new theme, which is a bit of a drag.

diegomarquez avatar Oct 15 '16 11:10 diegomarquez