Hello everyone,
I’m trying to highlight matching words or patterns in Sublime Text by changing the background color instead of the default foreground styling.
I’ve seen ways to underline or change text colors using tmTheme
or sublime-color-scheme
, but I specifically need a way to apply a background color to matched words .
What I’ve Tried:
- Using “regions” via a plugin:
python
CopyEdit
view.add_regions("highlight", [region], "region.greenish", "", sublime.DRAW_NO_OUTLINE)
- This works but doesn’t allow custom background colors beyond predefined region styles.
- Modifying
sublime-color-scheme
:
json
CopyEdit
{
"scope": "my_highlight",
"background": "#FFFF00"
}
- However, I’m not sure how to apply this dynamically to matches.
My Questions:
- Is there a way to dynamically apply background highlights to specific words using a plugin?
- Can I define a custom region style with a specific background color?
- If possible, how do I integrate this into a Sublime Text package/plugin?
Any guidance or examples would be greatly appreciated!
Thanks in advance!