Sublime Forum

Color picker - color insertion

#13

I emailed Jon about getting Tkinter installed into Sublime (manually) but after half an hour I couldn’t get it to work. Too many dependencies. And I’m not a Python developer by trade :smile:

0 Likes

#14

thanks for the update! cut and paste from a colorpicker it is then :frowning:

0 Likes

#15

I’ve tried again, but I got nowhere :frowning:

0 Likes

#16

[quote=“jbrooksuk”]

I emailed Jon about getting Tkinter installed into Sublime (manually) but after half an hour I couldn’t get it to work. Too many dependencies. And I’m not a Python developer by trade :smile:[/quote]

If you have a standard Python installation on you computer, why not directly calling a colorpicker from it ?
Look at Python2x\Tools\pynche\pyColorChooser.py for an example.
You could make a plugin that call the colorpicker and get the value back using stdout output (print) or clipboard.

Note that any colorpicker software that could copy the result to the clipboard work for this task.

0 Likes

#17

+1ing this. A huge feature for me. I’m using Sublime on linux.

0 Likes

#18

i think a colour pallet would be great

something similar to text mate for the mac, so could have transparent background etc would look great!!

0 Likes

#19

No color picker, but this is semi-related and pretty handy:

0 Likes

#20

I uploaded my plugin to GitHub, so you can install it with the Package Manager plugin by wbond.

Every now and then I still play around with the Tkinter stuff and an actual color picker. Shame it doesn’t always work.

0 Likes

#21

Somebody might want to play with this.

I keep getting this error:

Reloading plugin C:\Users\James.Brooks\AppData\Roaming\Sublime Text 2\Packages\Color Picker\color_picker.py Traceback (most recent call last): File ".\sublime_plugin.py", line 61, in reload_plugin File ".\color_picker.py", line 3, in <module> import Tkinter File ".\Tkinter.py", line 39, in <module> import _tkinter # If this fails your Python may not be configured for Tk ImportError: No module named _tkinter

Directions from Jon:

[code]* Copying _tkinter.pyd (and perhaps the tcl*.dll and tk*.dll) files from C:\Python26\DLLs to C:\Program Files\Sublime Text 2 (making sure you’re copying from the 64 bit version of Python if you’re using the 64 bit version of Sublime Text 2

  • Copying C:\Python26\lib\lib-tk to your package directory, so that it’ll be found when you import the modules.[/code]

Unpack this Zip into your Packages directory. If someone can get this to work you’ll be a leg-end.

0 Likes

#22

I Made a plugin that does pretty much what TextMate did

check out github.com/jnordberg/sublime-colorpick

0 Likes

#23

Looks pretty sweet!
Two things:
I had to change line 17 from:

args = [path.join(sublime.packages_path(), 'ColorPick', 'bin', 'colorpick')]
to

args = [path.join(sublime.packages_path(), 'sublime-colorpick', 'bin', 'colorpick')]
because the default folder name when you check out the repo is the repo name,
and I had to chmod +x the colorpick binary.

0 Likes

#24

Works great. One thing I noticed though: when the color panel is open, Sublime seems to stall until I close the colorpicker (gives me the SBBOD…) Other than that its seems great.

0 Likes

#25

Ah, so close! A few things:

  1. I added this simple bit to handle 3-color hex shorthand:
      if len(selected) == 3:
        selected += selected
  1. A bigger problem: if I close the Color Picker instead of clicking “Pick!” it goes into beachball and I have to force-quit ST2.

  2. Is it just me, or does it always open in HSB Sliders mode? It would be great if you could set that with something like /bin/colorpick -startPanel HexPicker or -startPanel ColorWheel. Not at all sure if that’s even possible, but it would be really helpful.

I would love to have this functionality working like TM, thanks for getting this started.

0 Likes

#26

Oh :frowning:

I get this error:

Traceback (most recent call last):
  File "./sublime_plugin.py", line 282, in run_
  File "./ColorPick.py", line 21, in run
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied
0 Likes

#27

Glad you guys like it :smile:

Nice, i gladly accept pull requests on github

See github.com/jnordberg/color-pick/issues/1

[quote=“natebeaty”]
3. Is it just me, or does it always open in HSB Sliders mode? It would be great if you could set that with something like /bin/colorpick -startPanel HexPicker or -startPanel ColorWheel. Not at all sure if that’s even possible, but it would be really helpful.

I would love to have this functionality working like TM, thanks for getting this started.[/quote]

Yeah, i hardcoded it like that since thats the mode i’m using myself :smile: Cocoa’s NSColorPanel allows you to set modes, i should make the binary remember what mode was last used and start up using that.

0 Likes

#28

Oh, and please make an issue on the github page if you have any problems or feature requests.

0 Likes

#29

[quote=“jbrooksuk”]Oh :frowning:

I get this error:

Traceback (most recent call last): File "./sublime_plugin.py", line 282, in run_ File "./ColorPick.py", line 21, in run File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__ errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child raise child_exception OSError: [Errno 13] Permission denied [/quote]

You have to chmod +x the executable (sublime-colorpick/bin/colorpick).

0 Likes

#30

Mas OS X only…

Me sad :frowning:

0 Likes

#31

Windows version (needs Powershell):

github.com/jeffory/ST2-Color-Picker

0 Likes

Color Picker plugin
#32

[quote=“jeffory”]Windows version (needs Powershell):

github.com/jeffory/ST2-Color-Picker[/quote]

If you have not used Powershell before, you have to start the command interface ( on Windows 7 just write powershell in the search box from the Start Menu ) and write in it the following code :

Set-ExecutionPolicy RemoteSigned

After that, Powershell should be available for use, and the Colour Picker should work.

This happens because Powershell is blocked by default ( you can’t run any code ).

For more details visit : http://technet.microsoft.com/en-us/library/ee176949.aspx

0 Likes