Skip to content

Commit

Permalink
Merge pull request #5 from cibinmathew/master
Browse files Browse the repository at this point in the history
Added configurable color selector
  • Loading branch information
kdnk committed Apr 16, 2023
2 parents 3814e82 + e0991eb commit b828f91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ Put settings like below to your keybinding file.

```
{ "keys": ["ctrl+super+j"], "command": "text_highlighter_toggle" }
// use specific color as below
{ "keys": ["ctrl+super+j"], "command": "text_highlighter_toggle", "args": { "color": "markup.changed.git_gutter"} }
{ "keys": ["ctrl+super+h"], "command": "text_highlighter_clear_all" }
```

### Available colors by scope

`[ markup.changed.git_gutter, support.class, markup.deleted.git_gutter, markup.inserted.git_gutter, constant.numeric, constant.character.escape, variable, string, comment ] `

## Inspired

Inspired by https://github.com/ryu1kn/vscode-text-marker
5 changes: 3 additions & 2 deletions highlighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class TextHighlighterToggleCommand(sublime_plugin.WindowCommand):
# TODO: run this command when new tab is opened
def run(self):
def run(self, color=None):
active_view = self.window.active_view()
selected_region = active_view.sel()
sel_string = active_view.substr(selected_region[0])
Expand All @@ -22,7 +22,8 @@ def run(self):
for view in views:
eraser(view, sel_string, color)
else:
color = find_usable_color(self.window, sel_string)
if not color:
color = find_usable_color(self.window, sel_string)
for view in views:
highlighter(view, sel_string, color)

Expand Down

0 comments on commit b828f91

Please sign in to comment.