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

Added configurable color selector #5

Merged
merged 3 commits into from
Apr 16, 2023
Merged

Added configurable color selector #5

merged 3 commits into from
Apr 16, 2023

Conversation

cibinmathew
Copy link
Contributor

@cibinmathew cibinmathew commented Apr 4, 2023

Added configurable color selector while defining commands/hotkeys. Previously a random available color was used. Now one can specify the color(colors are mapped based on scope)

{
    "keys": [ "ctrl+super+j" ],
    "command": "text_highlighter_toggle",
    "args": {
        "color": "markup.changed.git_gutter" <----additionaly specify the color argument
    }
}

@cibinmathew
Copy link
Contributor Author

@kdnk do you suggest adding more information on colors available

@kdnk
Copy link
Owner

kdnk commented Apr 5, 2023

@cibinmathew Thanks for creating this PR 🙂
Could you write some description about these changes?

@cibinmathew
Copy link
Contributor Author

@cibinmathew Thanks for creating this PR 🙂 Could you write some description about these changes?

Updated

@kdnk
Copy link
Owner

kdnk commented Apr 11, 2023

@cibinmathew Thanks!

@kdnk
Copy link
Owner

kdnk commented Apr 11, 2023

@cibinmathew

  • Do you mean we can pass only one color?
    • I think it might be more useful if we can pass a list of colors (and override the existing colors_by_scope), which means users can use any color they want.
  • You've mentioned https://www.sublimetext.com/docs/scope_naming.html, but will this PR work even if we pass some scope_naming that isn't defined in colors_by_scope?

@cibinmathew
Copy link
Contributor Author

cibinmathew commented Apr 11, 2023

This PR would work only for the 9 listed scopes in

colors_by_scope = OrderedDict() # TODO: Make color configurable
colors_by_scope['markup.changed.git_gutter'] = None # vivid purple
colors_by_scope['support.class'] = None # yellow
colors_by_scope['markup.deleted.git_gutter'] = None # vivid pink
colors_by_scope['markup.inserted.git_gutter'] = None # vivid green
colors_by_scope['constant.numeric'] = None # orange
colors_by_scope['constant.character.escape'] = None # light blue
colors_by_scope['variable'] = None # red
colors_by_scope['string'] = None # light green
colors_by_scope['comment'] = None # glay

I have added the list of the scopes in Readme. Probably can work on another PR later to add support to more scopes/colors.

{ "keys": ["ctrl+super+h"], "command": "text_highlighter_clear_all" }
```

### Available colors by scope
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kdnk available colors

Copy link
Owner

@kdnk kdnk Apr 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that readme😄. But I meant users can still path any scopes, and it might cause runtime errors if users passes scopes which are not listed on the readme. Am I missing something?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But... the current implementation might be sufficient😄 If we have proper safeguards in place for cases where users use non-listed colors, the plugin will still not work.

Copy link
Owner

@kdnk kdnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!!

@kdnk kdnk merged commit b828f91 into kdnk:master Apr 16, 2023
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

Successfully merging this pull request may close these issues.

2 participants