Kronuz / ColorHighlight

🎨 Lightweight Color Highlight colorizer for Sublime Text
MIT License
121 stars 12 forks source link

Does not work on M1 #26

Open loranger opened 2 years ago

loranger commented 2 years ago

Hi,

I went from Mac Intel to MBP M1 and my ColorHighlight pugin stopped working. I can't figure out why, because I was already using ST4 and python3.

Does one of you was able to make it work under Apple M1 ?

loranger commented 2 years ago

It's still bothering me, so I tried to digg a little deeper.

I finally came to the conclusion that my issue does not have anything related to Apple M1, Sublime Text 4 or Python version.

It seems there is an issue with the color scheme which makes this plugin fails on a fresh install : When the plugin is loading, it uses the current color scheme in order to use it, backup up and change it:

path = settings.get('color_scheme') or DEFAULT_COLOR_SCHEME
if not path.startswith('Packages/'):
    path = 'Packages/Color Scheme - Default/' + path
self.path = path[8:]

But as far as I understand, Sublime Text does not assume color scheme is loaded or stored in Packages/Color Scheme - Default anymore, so the plugin fails to load and backup the current color scheme, throws an exception and stop working.

I tried to change some stuffs, commenting code, changing paths, but I'm not experimented enough to make it work properly (or pushing a PR) The only workaround I found was to create the missing Packages/Color Scheme - Default/ path and duplicating my current color scheme there. Now it works for me, but this solution is definitely not future proof. Maybe @Kronuz would find an more elegant fix…

It may be related to #25 and #22

athrunsun commented 2 years ago

@loranger On my MacOS M1, I installed Gravity theme package and I have "color_scheme": "One Dark Gravity.sublime-color-scheme" in settings by default, it doesn't start with "Packages/" so this plugin will compose color scheme path by path = 'Packages/Color Scheme - Default/' + path, which is incorrect.

We can set "color_scheme": "Packages/Theme - Gravity/One Dark Gravity.sublime-color-scheme", however another issue arose - sublime text won't be able to find /Users/[username]/Library/Application Support/Sublime Text 3/Packages/Default/Preferences.sublime-settings.

So your solution is the best solution so far.