Sublime Forum

How to convert .sublime-color-scheme into .tmTheme?

#1

Would it be possible to convert a .sublime-color-scheme file into a .tmTheme?

Are these sublime-color-scheme files a superset of tmThemes? If it’s so, which features wouldn’t be possible to convert?

If not possible because they’re totally different files, would anyone know where to find a monokai theme which would give as similar results as possible than Monokai.sublime-color-scheme?

So far the ones I’ve tried will produce quite different results:

0 Likes

#2

There’s an automated method for turning tmTheme into sublime-color-scheme, but as far as I know there’s not one to go in the other direction so I imagine you’d have to do it yourself.

sublime-color-scheme files support variables and more ways to create and express colors that the older format can’t handle. That said, internally they both represent the same as far as Sublime is concerned.

The variables and color representations in sublime-color-scheme files are probably the hardest parts to translate over, but if you did it via a plugin in Sublime it’s probably fairly straight forward to do if you want to; in fact I think in one of my live streams I played around with that very concept, though I’m not sure which one that was in.

I imagine you just need to look inside of a build of Sublime from before sublime-color-scheme was introduced to get a tmTheme version that’s fairly similar. There might have been a lot of extra rules added since then to account for new syntax elements in the default packages, though.

1 Like

#3

Really!? I’ve been looking for this but couldn’t find any tooling. Do you have any pointers?

0 Likes

#4

This video explains how you can do it

(Note that if you are using ST 4094+ builds, then it’s not Convert Color Scheme anymore, but Plugin Development: Convert Color Scheme to .sublime-color-scheme is what you need to search in the command palette)

2 Likes

#5

Wow, thanks for the super quick reply!

tl;dw (for posterity): Command Palette: Convert Color Scheme

One (minor) issue with this that the command seems to be available only for files with the tmTheme extension.

I was editing a color scheme from a package that was using hidden-tmTheme extensions (don’t know why), and so this command didn’t appear at all in the Command Palette.

1 Like

#6

Yes, unfortunately, that command palette item is only active when there is a .tmTheme file open. It will not work for .hidden-tmTheme files. You may want to report an issue on the official issue tracker https://github.com/sublimehq/sublime_text/issues

0 Likes