-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Problem description
Some plugins about "highlighting" have to set colors for sublime.Regions. E.g., https://github.com/jfcherng-sublime/ST-RainbowIndent
Currently, the only way to set foreground/background color for a sublime.Region via plugin APIs is View.add_regions. That API requires a scope, which cannot be created by the plugin itself decently. That means end users have to add color scheme rules manually. Furthormore, from then on, they have to maintain their own color scheme file.
Imho, most Sublime Text users would consider this flow cumbersome and some don't even know what I am talking about (what's scope? what color rules? etc). They may expect they can directly specify color codes they want to used in the plugin settings.
Preferred solution
Allow providing color codes directly to View.add_regions method. By "color codes", I mean all these forms: https://www.sublimetext.com/docs/color_schemes.html#colors
Probably just let the existing scope argument accepts a dict-like color rule. E.g.,
view.add_regions(
scope={
# same with a color rule in a color scheme but without `scope`
"foreground": "rgba(229, 57, 53, 0.35)",
"background": "rgba(229, 57, 53, 0.2)",
},
# ... other arguments ...
)Alternatives
Allow plugins to manipulate in-memory color scheme rules so plugin authors can inject their own.
Additional Information
No response