Question

I just tried out Sublime Text 3, and everything went well except one problem: I couldn't change the color of the string class. every other functions, types has its own color that can be changed, but no matter what the theme I'm using, the string class is always the foreground color. The same problem seems to happen to namespace as well. Is there any way I can change them? It's nothing serious or functionally implicated, I'm simply a little perfectionist.enter image description here

P.S. I've located the .tmlanguage file and have resolved the namespace problem with another code I copied from a c++ 11 package. If you could just tell me which code to add to the .tmlanguage file to make the string class work, it would be the best. Thank you string and cout colored">

Was it helpful?

Solution

In Sublime, it is the color scheme .tmTheme file that is responsible for coloring elements of different scopes, which are defined by the language definition .tmLanguage file. Just about all strings are defined as part of the string scope, and many color schemes, including most of the ones included with Sublime, just have a single color for string. One issue I have with these color schemes is that they are generally based on a small handful of colors, and reuse them for many different scopes - Monokai and its derivatives are chief offenders of this crime, IMHO. If you want to change the color of the string scope, you'll need to find and edit the .tmTheme file associated with your color scheme.

In Sublime Text 3 this is most easily accomplished by installing @skuroda's PackageResourceViewer plugin via Package Control. Once installed, open the Command Palette and type prv, then choose PackageResourceViewer: Open Resource. If you're wishing to modify one of the built-in themes, navigate down to Color Schemes - Default, hit Enter or click, then scroll through the list until you find the name of the color scheme you're using. Hit Enter or click on it, and an XML file will open. Search for <string>string (make sure you don't have regex search turned on) and you should find the section you're looking for. Edit the hex color code to something more palatable, save the file, and your views will automatically be updated.

BTW, if you're looking for a complex, hugely-multicolored color scheme with a color definition for just about any scope out there, I recommend checking out the Neon Color Scheme, also available via Package Control. If you're curious, here's how your code snippet looks when using the full C++11 syntax definition:

C++11 with Neon.tmTheme

If you want, you can always modify it, or take pieces for your own work. Good luck!

OTHER TIPS

You should probably try a different syntax highlighter, there are several packages for C-like languages available via Package Control

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top