syntect: Problem loading sublime-color-scheme files
I was trying to use the official Monokai.sublime-color-scheme with syntect but it seems this file-format is not supported or maybe it’s just me doing something fishy.
I’ve tried to load it both as json or as xml (ie: used this converter https://www.freeformatter.com/json-to-xml-converter.html) but when feeding it with ThemeSet::get_theme it will crash.
On the other hand, if using a proper thTheme such as monokai.tmTheme there won’t be any problem.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 18 (3 by maintainers)
Commits related to this issue
- alpha values fixed by https://github.com/trishume/syntect/issues/244#issuecomment-621771989 — committed to roblav96/SublimeColorSchemeConverter by roblav96 6 years ago
Mostly because I only do open source for fun and out of generosity, and supporting the new theme format is so far down my todo list that I’ll never do it myself. I’d be happy to accept a PR to implement it, but I don’t think anyone really needs it since nearly all themes are available as tmThemes and I think the new format is reasonably complex, so I don’t expect anybody else to contribute it.
FYI: I just installed this Sublime plugin and opened up a relatively new
theme.sublime-color-scheme formatfile and CTRL+SHIFT+P to run theSublimeColorSchemeConverter: Convert to tmThemecommand to which I ended up with what appears to be a pretty good XML formattedtheme.tmThemefile.I’m hoping, anything that is a new feature from the source file will simply be ignored by syntect and, fingers crossed, it not throw any errors.
I’ll use this tmTheme with https://github.com/sharkdp/bat for a few days to see how it goes 🎉
Yah the new color scheme format is different and not supported yet and possibly ever
Hello everyone,
After getting into this issue myself with one of my projects, I made a solution that supports most features specified in the Sublime Color Scheme Docs.
It’s built with
serde,serde_json,syntect,thiserror,jsonc_parser, andpalette.I’ve tested it on themes like
Monokai,Nord,Gruvbox Material,Catppuccin, andKanagawa, and I’m happy to say they all work as far as I can tell.I’d like to also thank @philpax for supplying the original code that kick started this whole thing in the place.
I would love to see this implemented in base
syntect, but I’m happy with my solution, I’ll put a link to it right here if anybody is interested in it.If any are interested on how they turned out visually, I took some screenshots down below of some example code.
Screenshots
Kanagawa
Catppuccin
Nord
Monokai
Gruvbox Material
Hi all,
I ran into this when trying to use Ayu Dark (which is no longer distributed as a
tmTheme) and decided I’d cobble together an implementation (built on top ofserde,serde_json,syntect 5.2, andthiserror):From my brief testing, this seems to work as expected. It might not handle all of the cases - it was a fairly mechanical translation - but it should get you going. Here’s an example of how to use it:
Hope this helps unblock someone! 🙂
(I’d make a PR, but I’m not sure what test data I’d have to supply and such. I leave that up to the maintainers and anyone else interested.)
I had a play around with it, and this works for me with that color scheme:
I’m not convinced it correctly calculates nested alpha modifiers though…
Just for the record… my previous thumbdown icon is mainly because your “possibly ever” end of statement, why do you think this one is not interesting but supporting old verbose meaty xml files that should be burn in hell is better?
You know, I know and everybody knows… but here’s some random link google gave me after searching “json vs xml” -> https://blog.cloud-elements.com/json-better-xml.
As for json vs yaml I don’t have any strong opinnion though, here’s some random link https://www.json2yaml.com/yaml-vs-json
Very cool, thanks for sharing @Lepidopteran ! I personally think it would make sense to have that functionality in
syntectdirectly, mainly because I don’t see any other way to easily add https://www.sublimetext.com/docs/color_schemes.html#hashed-syntax-highlighting support…