This is a POC. I want to generate a proper wheel, but I don’t know how well it’ll work.
You can get it from here.
Note: Colours aren’t currently inserted into the view yet.
This is a POC. I want to generate a proper wheel, but I don’t know how well it’ll work.
You can get it from here.
Note: Colours aren’t currently inserted into the view yet.
@jbrooksuk, this will allow you to insert:
[pre=#232628]class ColortipEventCommand(sublime_plugin.EventListener):
…
def run(self, view, where):
…
for scope in scopes:
if (scope+'') in scope_name:
if (scope == 'constant.other.color.rgb-value.css' and '#' in view.substr(view.word(view.sel()0]))) or scope == 'meta.property-value.css':
view.show_popup(''.join(self.colors), sublime.COOPERATE_WITH_AUTO_COMPLETE, location=-1, max_width=500, on_navigate=lambda color, view=view: handle_selected_color(view, color))
…
def handle_selected_color(view, color):
view.run_command(“insert”, { “characters”: color })
view.hide_popup()[/pre]
And the magic behind that:
view.show_popup('<i style="color:red">▇</i><i style="color:blue">▇</i><i style="color:green">▇</i>', on_navigate=print)
Long story short, pick a block char from here: copypastecharacter.com/all-characters and go crazy
[quote=“iamntz”]And the magic behind that:
view.show_popup('<i style="color:red">▇</i><i style="color:blue">▇</i><i style="color:green">▇</i>', on_navigate=print)
Long story short, pick a block char from here: copypastecharacter.com/all-characters and go crazy [/quote]
All we need now is a proper color grid.
Btw, if you’re doing sublime.set_timeout(lambda:self.run(view, 'selection_modified'), 0)
you might as well use the async events. Since show_popup is ST3-only anyway you don’t need to worry about backwards compatability.
It would be nice if we could set the colors. So I could work with a color pallette for a given project. Or it could find colors already used. But thats a lot of dreaming
I’ve just applied an update that will allow you to add your own hex colors as project colors. You can get it at https://github.com/huot25/SmartColorPicker. I still have some work to do on validation and a few other things, but I think it will do what you need for now. I welcome any feedback you may have if you decide to try it as it is .
[quote=“jbrooksuk”]
You should check out Color Picker Tooltip for that.[/quote]
Thank you for the plug !