Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change color #17

Open
kathcode opened this issue Jul 6, 2015 · 2 comments
Open

Change color #17

kathcode opened this issue Jul 6, 2015 · 2 comments

Comments

@kathcode
Copy link

kathcode commented Jul 6, 2015

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

@nimylian
Copy link

@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 = ""

@diegomarquez
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants