Sublime Forum

Seeing "Error loading colour scheme" for a language-specific theme

#1

I’m having difficulty applying a custom color scheme to specific file types in Sublime Text 3, Build 3114. Currently one of these is working, where I’m applying the Twilight theme to JavaScript files. To do that, I’ve got a JavaScript.sublime-settings file with these contents:

{
“color_scheme”: “Packages/Color Scheme - Default/Twilight.tmTheme”
}

Since I’d like to apply a different scheme, VisualStudioDark, to C# files, I created a C#.sublime-settings file and added these contents:

{
“color_scheme”: “Themes/VisualStudioDark.tmTheme”
}

I’ve tried placing the VisualStudioDark.tmTheme file into the following directories, and adjusting the path above accordingly:

  • Sublime Text 3\Packages
  • Sublime Text 3\Themes

But I still get the following error message when attempting to open a C# (.cs) file in Sublime Text 3.
“Error loading colour scheme Themes/VisualStudioDark.tmTheme: Unable to open Themes/VisualStudioDark.tmTheme”.

I’m using Windows 8.1. How can I fix this so the custom theme will work? Thanks.

1 Like

#2

The error message sounds like it’s having problems finding the actual theme file; are you sure that the path to the color scheme is correct?

[edit]
Upon posting that, I realized that you were asking about the color scheme itself, whoops. Sorry about that.

Did you try creating the directory (for example) Sublime Text 3\Packages\VisualStudioDark, dropping the file in there, and then using the path Packages/VisualStudioDark/VisualStudioDark.tmTheme?

This package seems to be available via Package Control, so you may want to try installing it that way; then the advice I mention below might actually be of use. :blush:.
[/edit]

To double check you could change your global color scheme to Visual Studio Dark and then check your preferences and copy the color_scheme line from there to your C# specific config file.

0 Likes

#3

Thanks for helping me out.

Yes, I just tried that. Here is the full file path:
C:\Program Files\Sublime Text 3\VisualStudioDark\VisualStudioDark.tmTheme

And here is the error message that now appears.

Error loading colour scheme VisualStudioDark/VisualStudioDark.tmTheme: Unable to open VisualStudioDark/VisualStudioDark.tmTheme

Being new to Sublime Text, I’m unfamiliar with Package Control. I’ll try that next.

0 Likes

#4

The place to put your own packages is the path opened by the Preferences > Browse Packages directory; I don’t think that’s the path that you specified above (but I’m not using Windows 8 so I don’t know if it uses a different location there).

Package Control is boss, I highly recommend it. :slightly_smiling:

0 Likes

#5

Well, I’m not having any luck here. I just don’t understand how to install a custom theme. I’m looking at this link now. http://colorsublime.com/how-to-install-a-theme

0 Likes

#6

Here’s a step by step guide that works for me:

  1. Select Preferences > Browse Packages... from the Menu (you’re not using MacOS, but if you were, the Preferences menu is under Sublime Text in the menu, in case someone else comes across this topic).
  2. In the window that opens, create a folder with some name; I used CustomColors but you could name it anything you want. In lieu of this step, you can not create any folder at all and use the already existing User directory.
  3. Drop the color scheme file into the folder you created (here either CustomColors or User); it is important that the file have a .tmTheme extension so that Sublime knows it is a color scheme).
  4. Quit and restart Sublime

Now, in your Preferences > Color Scheme menu, you should see an entry that is named after the path that you used in step #2/#3 above (e.g. Custom Colors or User), and that entry will have an entry for the name of the color scheme that you installed (e.g. Visual Studio Dark).

In order to set this color scheme in your config, the format is something like:

"color_scheme": "Packages/CustomColors/VisualStudioDark.tmTheme"

or

"color_scheme": "Packages/User/VisualStudioDark.tmTheme"

The main pitfall would be dropping the file into a place where sublime is not going to look for it, or getting the filename wrong; for example, when I downloaded the file above from github my browser put a .txt extension on it, which Sublime will ignore.

Using the Preferences > Browse Packages... menu item will make sure that you’re definitly working with a path that Sublime knows about.

2 Likes

#7

Your fix worked! So the core problem that I had was the assumption that the schemes belonged in one directory, when they actually should have been somewhere else. Here is where I thought they should be:
C:\Program Files\Sublime Text 3\Packages

And here is where they actually should go:
C:\Users\myname\AppData\Roaming\Sublime Text 3\Packages\User

Following your steps, Preferences > Browse Packages, led me to the correct directory. As you said, Sublime Text picks up the subdirectories. Thanks for your patience and help.

1 Like

#8

Glad we got you all sorted out!

0 Likes