diff --git a/ColorHelper.sublime-settings b/ColorHelper.sublime-settings index 72833bc8..a182e2c1 100755 --- a/ColorHelper.sublime-settings +++ b/ColorHelper.sublime-settings @@ -1,230 +1,230 @@ { - // Show debug logging - "debug": false, - - // Show index status in the status bar. - "show_index_status": true, - - // Show popups automatically in configured files. - "auto_popup": true, - - // Upper case hex when inserting - "upper_case_hex": false, - - // Use webcolor names when value color matches a webcolor name. - "use_webcolor_names": true, - - // For Windows 10 HiDpi setups. This is a temporary workaround - // to help reduce abnormally large color previews and other images. - // This will be removed once the issue is fixed in Sublime Text 3. - "line_height_workaround": false, - - // Color picker and palette picker by default - // are accessed by clicking an icon on the color info panel. - // Click access for one of these can be moved to the color box - // (visual representation of the color). - // (none|color_picker|palette_picker) - "click_color_box_to_pick": "none", - - // Enables inline color previews found beside the identified color. - // Requires ST 3116+ and mdpopups 1.7.4 - "inline_previews": true, - - // Adjust the size of inline image previews by the offset given. - // Please use either a positive or negative number. - "inline_preview_offset": 0, - - // Adjust the position of inline image previews. - // (left|right) - "inline_preview_position": "left", - - // Enable color picker option. Will use native color picker - // unless "use_color_picker_package" is enabled and external - // package is installed. - "enable_color_picker": true, - - // If the color picker is too big or too small, try playing with this. - // This is a coarse control which scales image size relative to the - // approximate line height. small (1x), medium (1.5x), and large (2x). - // (small | medium | large) - "graphic_size": "medium", - - // Fine scaling of image sizes. Overrides `graphic_size`. - // Use an integer or floating point value. `null` disables fine scaling. - "graphic_scale": null, - - // Use https://github.com/weslly/ColorPicker for the color picker if installed. - "use_color_picker_package": false, - - // This can be turned off to get a rectangular color picker - // That displays possible options by hue and brightness/luminance. - "use_hex_color_picker": true, - - // Show global palettes in palette panel - "enable_global_user_palettes": true, - - // Enable storing favorite colors to the favorite palette - "enable_favorite_palette": true, - - // Enable showing current file color palette - "enable_current_file_palette": true, - - // Enable color conversion options on color info panel - "enable_color_conversions": true, - - // Scanning rules - "color_scanning": [ - { - "syntax_files": [], - "syntax_filter": "whitelist", - "base_scopes": [ - "source.css", - "text.html" - ], - "scan_scopes": [ - // https://packagecontrol.io/packages/CSS3 - "meta.declaration-list.css -support.type.property-name.css -comment -string", - // CSS, CSS in HTML etc. (based on: Sublime Default) - "meta.property-value.css -comment -string", - // CSS3, CSS3 in HTML etc. (based on: https://packagecontrol.io/packages/CSS3) - "meta.value.css -comment -string", - // HTML attributes (based on: Sublime Default) - // "meta.tag.inline.any.html string.quoted -constant.character.entity.html", (Commented to prevent colors in certain HTML attributes) - "meta.tag.any.html meta.attribute-with-value.style.html" - ], - "scan_completion_scopes": [], - "extensions": [], - "allowed_colors": ["css4"], - "use_hex_argb": false, - "compress_hex_output": true - }, - { - //Sass (based on: https://packagecontrol.io/packages/Sass) - "syntax_files": ["Sass/Syntaxes/Sass", "Sass/Syntaxes/SCSS"], - "syntax_filter": "whitelist", - "base_scopes": [ - "source.sass", - "source.scss" - ], - "scan_scopes": [ - "source.sass meta.property-value.css -comment -string", - "source.scss meta.property-value.css -comment -string" - ], - "scan_completion_scopes": [ - "source.scss meta.property-value.css -comment -string", - "source.sass meta.property-value.css -comment -string" - ], - "extensions": [], - "allowed_colors": ["css4"], - "use_hex_argb": false, - "compress_hex_output": true - }, - { - // SCSS (based on https://packagecontrol.io/packages/SCSS) - "syntax_files": ["SCSS/SCSS"], - "syntax_filter": "whitelist", - "base_scopes": [ - "source.scss" - ], - "scan_scopes": [ - "source.scss -comment -string" - ], - "scan_completion_scopes": [ - "source.scss" - ], - "extensions": [], - "allowed_colors": ["css4"], - "use_hex_argb": false, - "compress_hex_output": true - }, - { - // SCSS (based on https://packagecontrol.io/packages/Syntax%20Highlighting%20for%20Sass) - "syntax_files": [ - "Syntax Highlighting for Sass/Syntaxes/SCSS", - "Syntax Highlighting for Sass/Syntaxes/Sass" - ], - "syntax_filter": "whitelist", - "base_scopes": [ - "source.scss", - "source.sass" - ], - "scan_scopes": [ - "source.scss -comment -string -support.type.property-name", - "source.sass -comment -string -support.type.property-name" - ], - "scan_completion_scopes": [ - "source.scss -comment -string -support.type.property-name", - "source.sass -comment -string -support.type.property-name" - ], - "extensions": [], - "allowed_colors": ["css4"], - "use_hex_argb": false, - "compress_hex_output": true - }, - { - // Sass (based on https://packagecontrol.io/packages/Syntax%20Highlighting%20for%20PostCSS) - "syntax_files": ["Syntax Highlighting for PostCSS/Syntaxes/PostCSS"], - "syntax_filter": "whitelist", - "base_scopes": [ - "source.postcss" - ], - "scan_scopes": [ - "source.postcss meta.property-list.css.postcss -comment -string" - ], - "scan_completion_scopes": [ - "source.postcss meta.property-list.css.postcss -comment -string" - ], - "extensions": [], - "allowed_colors": ["css4"], - "use_hex_argb": false, - "compress_hex_output": true - }, - { - "syntax_files": [], - "syntax_filter": "whitelist", - "base_scopes": ["text.xml"], - "scan_scopes": ["text.xml -meta.tag.xml -comment -string, string.unquoted.cdata.xml"], - "allowed_colors": ["hex", "hexa", "hex_compressed"], - "extensions": [".tmTheme", ".hidden-tmTheme", ".stTheme"], - "use_hex_argb": false, - "compress_hex_output": false - }, - { - "syntax_files": [], - "syntax_filter": "whitelist", - "base_scopes": ["source.stylus"], - "scan_scopes": [ - // Based on https://github.com/billymoon/Stylus/blob/master/Stylus.tmLanguage - "constant.other.color.rgb-value.stylus", - "constant.color.w3c-standard-color-name.stylus", - "meta.property-value.stylus" - ], - "allowed_colors": ["css3"], - "extensions": [], - "use_hex_argb": false, - "compress_hex_output": true - }, - { - "syntax_files": [], - "syntax_filter": "whitelist", - "base_scopes": ["source.less"], - "scan_scopes": [ - "constant.other.color.rgb-value.css", - "constant.color.w3c-standard-color-name.css", - "meta.property-value.css" - ], - "allowed_colors": ["css3"], - "extensions": [], - "use_hex_argb": false, - "compress_hex_output": true - } - ], - - // Enable project palettes in palette panel (Palettes stored in project file). - "enable_project_user_palettes": true, - - // Override image border color. This is mainly for schemes that use a dramatically different - // background for popups vs code background. Color should be in the form `#RRGGBB`. Alpha channels will - // be ignored. - "image_border_color": null + // Show debug logging + "debug": false, + + // Show index status in the status bar. + "show_index_status": true, + + // Show popups automatically in configured files. + "auto_popup": true, + + // Upper case hex when inserting + "upper_case_hex": false, + + // Use webcolor names when value color matches a webcolor name. + "use_webcolor_names": true, + + // For Windows 10 HiDpi setups. This is a temporary workaround + // to help reduce abnormally large color previews and other images. + // This will be removed once the issue is fixed in Sublime Text 3. + "line_height_workaround": false, + + // Color picker and palette picker by default + // are accessed by clicking an icon on the color info panel. + // Click access for one of these can be moved to the color box + // (visual representation of the color). + // (none|color_picker|palette_picker) + "click_color_box_to_pick": "none", + + // Enables inline color previews found beside the identified color. + // Requires ST 3116+ and mdpopups 1.7.4 + "inline_previews": true, + + // Adjust the size of inline image previews by the offset given. + // Please use either a positive or negative number. + "inline_preview_offset": 0, + + // Adjust the position of inline image previews. + // (left|right) + "inline_preview_position": "left", + + // Enable color picker option. Will use native color picker + // unless "use_color_picker_package" is enabled and external + // package is installed. + "enable_color_picker": true, + + // If the color picker is too big or too small, try playing with this. + // This is a coarse control which scales image size relative to the + // approximate line height. small (1x), medium (1.5x), and large (2x). + // (small | medium | large) + "graphic_size": "medium", + + // Fine scaling of image sizes. Overrides `graphic_size`. + // Use an integer or floating point value. `null` disables fine scaling. + "graphic_scale": null, + + // Use https://github.com/weslly/ColorPicker for the color picker if installed. + "use_color_picker_package": false, + + // This can be turned off to get a rectangular color picker + // That displays possible options by hue and brightness/luminance. + "use_hex_color_picker": true, + + // Show global palettes in palette panel + "enable_global_user_palettes": true, + + // Enable storing favorite colors to the favorite palette + "enable_favorite_palette": true, + + // Enable showing current file color palette + "enable_current_file_palette": true, + + // Enable color conversion options on color info panel + "enable_color_conversions": true, + + // Scanning rules + "color_scanning": [ + { + "syntax_files": [], + "syntax_filter": "whitelist", + "base_scopes": [ + "source.css", + "text.html" + ], + "scan_scopes": [ + // https://packagecontrol.io/packages/CSS3 + "meta.declaration-list.css -support.type.property-name.css -comment -string", + // CSS, CSS in HTML etc. (based on: Sublime Default) + "meta.property-value.css -comment -string", + // CSS3, CSS3 in HTML etc. (based on: https://packagecontrol.io/packages/CSS3) + "meta.value.css -comment -string", + // HTML attributes (based on: Sublime Default) + // "meta.tag.inline.any.html string.quoted -constant.character.entity.html", (Commented to prevent colors in certain HTML attributes) + "meta.tag.any.html meta.attribute-with-value.style.html" + ], + "scan_completion_scopes": [], + "extensions": [], + "allowed_colors": ["css4"], + "use_hex_argb": false, + "compress_hex_output": true + }, + { + //Sass (based on: https://packagecontrol.io/packages/Sass) + "syntax_files": ["Sass/Syntaxes/Sass", "Sass/Syntaxes/SCSS"], + "syntax_filter": "whitelist", + "base_scopes": [ + "source.sass", + "source.scss" + ], + "scan_scopes": [ + "source.sass meta.property-value.css -comment -string", + "source.scss meta.property-value.css -comment -string" + ], + "scan_completion_scopes": [ + "source.scss meta.property-value.css -comment -string", + "source.sass meta.property-value.css -comment -string" + ], + "extensions": [], + "allowed_colors": ["css4"], + "use_hex_argb": false, + "compress_hex_output": true + }, + { + // SCSS (based on https://packagecontrol.io/packages/SCSS) + "syntax_files": ["SCSS/SCSS"], + "syntax_filter": "whitelist", + "base_scopes": [ + "source.scss" + ], + "scan_scopes": [ + "source.scss -comment -string" + ], + "scan_completion_scopes": [ + "source.scss" + ], + "extensions": [], + "allowed_colors": ["css4"], + "use_hex_argb": false, + "compress_hex_output": true + }, + { + // SCSS (based on https://packagecontrol.io/packages/Syntax%20Highlighting%20for%20Sass) + "syntax_files": [ + "Syntax Highlighting for Sass/Syntaxes/SCSS", + "Syntax Highlighting for Sass/Syntaxes/Sass" + ], + "syntax_filter": "whitelist", + "base_scopes": [ + "source.scss", + "source.sass" + ], + "scan_scopes": [ + "source.scss -comment -string -support.type.property-name", + "source.sass -comment -string -support.type.property-name" + ], + "scan_completion_scopes": [ + "source.scss -comment -string -support.type.property-name", + "source.sass -comment -string -support.type.property-name" + ], + "extensions": [], + "allowed_colors": ["css4"], + "use_hex_argb": false, + "compress_hex_output": true + }, + { + // Sass (based on https://packagecontrol.io/packages/Syntax%20Highlighting%20for%20PostCSS) + "syntax_files": ["Syntax Highlighting for PostCSS/Syntaxes/PostCSS"], + "syntax_filter": "whitelist", + "base_scopes": [ + "source.postcss" + ], + "scan_scopes": [ + "source.postcss meta.property-list.css.postcss -comment -string" + ], + "scan_completion_scopes": [ + "source.postcss meta.property-list.css.postcss -comment -string" + ], + "extensions": [], + "allowed_colors": ["css4"], + "use_hex_argb": false, + "compress_hex_output": true + }, + { + "syntax_files": [], + "syntax_filter": "whitelist", + "base_scopes": ["text.xml"], + "scan_scopes": ["text.xml -meta.tag.xml -comment -string, string.unquoted.cdata.xml"], + "allowed_colors": ["hex", "hexa", "hex_compressed"], + "extensions": [".tmTheme", ".hidden-tmTheme", ".stTheme"], + "use_hex_argb": false, + "compress_hex_output": false + }, + { + "syntax_files": [], + "syntax_filter": "whitelist", + "base_scopes": ["source.stylus"], + "scan_scopes": [ + // Based on https://github.com/billymoon/Stylus/blob/master/Stylus.tmLanguage + "constant.other.color.rgb-value.stylus", + "constant.color.w3c-standard-color-name.stylus", + "meta.property-value.stylus" + ], + "allowed_colors": ["css3"], + "extensions": [], + "use_hex_argb": false, + "compress_hex_output": true + }, + { + "syntax_files": [], + "syntax_filter": "whitelist", + "base_scopes": ["source.less"], + "scan_scopes": [ + "constant.other.color.rgb-value.css", + "constant.color.w3c-standard-color-name.css", + "meta.property-value.css" + ], + "allowed_colors": ["css3"], + "extensions": [], + "use_hex_argb": false, + "compress_hex_output": true + } + ], + + // Enable project palettes in palette panel (Palettes stored in project file). + "enable_project_user_palettes": true, + + // Override image border color. This is mainly for schemes that use a dramatically different + // background for popups vs code background. Color should be in the form `#RRGGBB`. Alpha channels will + // be ignored. + "image_border_color": null } diff --git a/utils.py b/utils.py index a7716872..2bee9f37 100644 --- a/utils.py +++ b/utils.py @@ -1,4 +1,4 @@ -"""Custom utils.""" +"""Custom utilities.""" import sublime import sublime_plugin import os @@ -23,8 +23,6 @@ def run(self, **kwargs): try: expanded_source_path = sublime.expand_variables(kwargs.get('file'), self.window.extract_variables()) - # package_name = os.path.basename(os.path.dirname(expanded_source_path.replace(sublime.packages_path(), - # ''))) resource_path = 'Packages' + expanded_source_path.replace(sublime.packages_path(), '') sublime.load_resource(resource_path) if 'default' in kwargs: @@ -44,9 +42,8 @@ def run(self, **kwargs): os.makedirs(expanded_target_directory) try: - expanded_source_path = sublime.expand_variables(kwargs.get('base_file'), self.window.extract_variables()) - # package_name = os.path.basename(os.path.dirname(expanded_source_path.replace(sublime.packages_path(), - # ''))) + expanded_source_path = sublime.expand_variables(kwargs.get('base_file'), + self.window.extract_variables()) resource_path = 'Packages' + expanded_source_path.replace(sublime.packages_path(), '') sublime.load_resource(resource_path) @@ -56,10 +53,6 @@ def run(self, **kwargs): kwargs['file'] = kwargs.get('user_file') del kwargs['user_file'] else: - # expanded_source_path = sublime.expand_variables(kwargs.get('base_file'), - # self.window.extract_variables()) - # kwargs['file'] = expanded_source_path.replace(sublime.packages_path(), - # os.path.join(sublime.packages_path(), 'User')) kwargs['file'] = os.path.join(sublime.packages_path(), 'User', os.path.basename(kwargs.get('base_file'))) del kwargs['base_file']