diff --git a/lib/linux_colorpicker.py b/lib/linux_colorpicker.py index 1aa3d7b..a0e8e70 100755 --- a/lib/linux_colorpicker.py +++ b/lib/linux_colorpicker.py @@ -1,7 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys - wx = None Gtk = None @@ -9,6 +8,7 @@ import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk + from gi.repository import Gdk except ImportError: try: import gtk as Gtk @@ -24,7 +24,6 @@ def open_color_picker_via_gtk(): color_sel = Gtk.ColorSelectionDialog("Sublime Color Picker") - if len(sys.argv) > 1: current_color = Gdk.color_parse(sys.argv[1]) if current_color: diff --git a/sublimecp.py b/sublimecp.py index 442a5c1..8a4ee0e 100755 --- a/sublimecp.py +++ b/sublimecp.py @@ -4,10 +4,10 @@ import os from stat import * -sublime_version = 2 +sublime_version = 3 -if not sublime.version() or int(sublime.version()) > 3000: - sublime_version = 3 +if not sublime.version() or int(sublime.version()) > 4000: + sublime_version = 4 if sublime.platform() == 'windows': @@ -362,13 +362,17 @@ def run(self, settings): class ColorPickCommand(sublime_plugin.TextCommand): def run(self, edit): sel = self.view.sel() + selected = None prefix = '#' + # get the currently selected color - if any if len(sel) > 0: selected = self.view.substr(self.view.word(sel[0])).strip() if selected.startswith('#'): selected = selected[1:] + elif selected.startswith('\''): + selected = selected[2:] elif selected.startswith('0x'): selected = selected[2:] prefix = '0x'