redoPop / SublimeGremlins

Reveal odd and invisible whitespace characters in Sublime Text.
43 stars 3 forks source link

Change color of Gremlin? #8

Closed ryanpcmcquen closed 5 years ago

ryanpcmcquen commented 5 years ago

Is there a way to change the color of the Gremlin for custom color schemes?

Screen Shot 2019-07-11 at 3 06 28 PM

redoPop commented 5 years ago

The original icon is white. The tint that's used is defined by your theme or color scheme's settings for the "invalid" scope. Which theme are you using?

ryanpcmcquen commented 5 years ago

https://github.com/ryanpcmcquen/sublime_witness

Thanks, I fixed it!

ryanpcmcquen commented 4 years ago

Would you ever consider having a preferences override for this @redoPop?

redoPop commented 4 years ago

Oo-er. Maybe. I don't think it'd be the override you have in mind, and it'd be a bit of a footgun. Here's the deal:

Gutter icons are drawn via the add_regions method documented here which colorizes the icon according to the region's scope. Gremlins uses the invalid scope for its regions because it's the only one of the "minimal" scopes that's intended to stand in contrast with both the background and foreground (text) colors. The exact color associated with a scope depends on the color scheme but every color scheme should follow the scope-naming guide.

We could allow users to override "invalid" with a different scope defined in their color scheme, but they'd have to know their color scheme intimately and they'd have to keep Gremlins in mind when they change color scheme: they could easily pick a scope that's less suitable for Gremlins (e.g. one that has some other syntax-specific association) or one that's undefined in other color schemes (e.g. one that's intended for theme/syntax/plugin-specific use). If either of those things go wrong, they could end up with invisible gremlins.

I know some packages support such an override – e.g. Sublime LSP's "document_highlight_scopes" – but they typically add a lot of additional code to safeguard against inappropriate scope choices and TBH I don't fancy maintaining complicated safeguards like that in Gremlins. I'd like to keep this plugin small and simple, and in this case that means there's a good chance users would shoot themselves in the foot with such an override.

ryanpcmcquen commented 4 years ago

I'm actually 100% fine with the simple version of that implementation. My main use case is color schemes that have a poorly defined invalid color and are otherwise a wonderful theme. An immediate example is one of the default Sublime color schemes, which I logged a bug against here: https://github.com/sublimehq/sublime_text/issues/3259

redoPop commented 3 years ago

Was cleaning out my todos at the end of last year and realized I never followed up on this thread: the simple (configurable scope) implementation has been added to SublimeGremlins and is part of the current release.