Sublime Forum

Best way to customize Theme / Colors / Syntaxhighlighting

#1

Hi!

Yesterday I started using SublimeText2 (replacing my Textwrangler on OSX) and am loving the customizability so far. Great work!

I want to use a dark color theme and find “All Hallow’s Eve” basically matching for a start. However I am missing more distinct colors. I am mostly using PHP syntax highlighting and specifically want to adjust:

  • Color of $variable to be distinct
  • Color of CONSTANTS to be distinct
  • Color of PHP functions (like htmlspecialchars()) and self-defined functions to be the same - so basically function() should look the same, no matter if it’s built-in or my own function
  • HTML tags within PHP variables should have a different color for the and the content within …

Now how do I start?

It seems that PHP.tmLanguage is used to assign distinct keys for each syntax specification, and then a .thTheme file can use that key for styling? The PHP.tmLanguage mentions that HTML.tmLanguage is actually used, so where/how do I look for the names of the syntax definitions that I mentioned earlier?

Thanks for any pointers,
Garvin

0 Likes

#2

I made a custom themed that was originally a copy of the them “Solarized (Dark).tmTheme” that comes with ST2. The main reason I picked that theme is it seems to have good php support. From what I can tell different themes support different languages better then others depending on how specific the syntax matching rules are. Just copy the “Solarized (Dark).tmTheme” file and rename it to anything, then you can edit it. Once your done just select it as your new them.

0 Likes

#3

I’m bumping this thread with a syntax highlight related question.

So my question, is there any way to set a file name specific syntax highlight color scheme?

I have a script that i use for daily work, exp.: workscript.ahk When i adding new features to the script i use a new file like: workscript_beta.ahk. But sometimes i got confused - since the code mostly identical - and sometimes i’m changing the “wrong” file, aka. the normal daily work file. Is that possible to use 2 different color scheme for each file?

0 Likes

#4

On a given view, you can set the color_scheme setting for a specific file, but it won’t be remembered if you close it and open it again. Maybe you could save this as a plugin and make sure you execute it each time you open your productive file…

view.settings().set('color_scheme', 'Packages/Color Scheme - Default/Solarized (Dark).tmTheme')
0 Likes

#5

[quote=“jbjornson”]On a given view, you can set the color_scheme setting for a specific file, but it won’t be remembered if you close it and open it again. Maybe you could save this as a plugin and make sure you execute it each time you open your productive file…

view.settings().set('color_scheme', 'Packages/Color Scheme - Default/Solarized (Dark).tmTheme') [/quote]

This is good enough, thanks!

0 Likes