facelessuser / ColorHelper

Sublime plugin that provides helpful color previews and tooltips
https://facelessuser.github.io/ColorHelper/
MIT License
254 stars 30 forks source link

Not replacing colors in Sublime color scheme files, but works in CSS #224

Closed MattDMo closed 2 years ago

MattDMo commented 2 years ago

Description

Clicking on a color preview in a .sublime-color-scheme file doesn't allow you to change the color. The following traceback appears in the console:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1488, in run_
    return self.run(edit, **args)
  File "/Users/mattdmo/Library/Application Support/Sublime Text/Installed Packages/ColorHelper.sublime-package/ch_panel.py", line 779, in run
  File "/Users/mattdmo/Library/Application Support/Sublime Text/Installed Packages/ColorHelper.sublime-package/ch_panel.py", line 503, in show_insert
  File "/Users/mattdmo/Library/Application Support/Sublime Text/Installed Packages/ColorHelper.sublime-package/custom/st_colormod.py", line 599, in __init__
  File "/Users/mattdmo/Library/Application Support/Sublime Text/Installed Packages/ColorHelper.sublime-package/lib/coloraide/color.py", line 193, in __init__
  File "/Users/mattdmo/Library/Application Support/Sublime Text/Installed Packages/ColorHelper.sublime-package/custom/st_colormod.py", line 648, in _parse
TypeError: '<class 'ColorHelper.ch_util.Color'>' is an unrecognized type

I've replicated this behavior in both macOS and Linux (running in a VM on the Mac) using Build 4134. I was also able to replicate it on the Mac in safe mode, after installing Package Control, ColorHelper, and PackageDev (needed b/c I'm working on a .sublime-color-scheme file).

Very interestingly, I can't replicate it when working on a new CSS file:

.foo {
    background: #ea7935;
}

Support Info

Steps to Reproduce Issue

  1. Start Build 3134 in Safe Mode.

  2. Install Package Control, then install ColorHelper and PackageDev.

  3. Open Neon.sublime-color-scheme and wait for color previews to appear.

  4. Click on a color preview, such as the one in the top "variables" section next to the final variable "pink".

    image
  5. Click on Picker to open the color picker (Mac), or just click on the pink box (Linux).

    image
  6. Click on any color you like in the color picker, then click on the Select button.

  7. The original color #FF01C3 will not change, and the traceback above will appear in the console. The window with all the insert buttons does not appear.

I'm using the default preferences in Safe Mode.

facelessuser commented 2 years ago

Thanks for the report! Found the issue.

@gir-bot remove S: triage @gir-bot add T: bug, S: confirmed

facelessuser commented 2 years ago

This turned out to be an untested case when we switched to a more dynamic base Color object. ST Color Mod is the only custom plugin that overrides many of the guts of the color object to provide special handling of color mod syntax. We simply forgot to make sure it is comparing its type check against the dynamic base.

I have a local fix and will be in the next release. I may push a quick bugfix out tonight.

facelessuser commented 2 years ago

Fix was tagged, should be available in Package Control within an hour or two.