Home Download Buy Blog Forum Support

monokai theme

monokai theme

Postby Perkin5 on Wed Jan 02, 2013 11:21 pm

I want to modify the color of PHP tags but, on looking through the tmTheme file (and experimentally changing most of the hex codes) I can't find anything that affects them.

Can anyone help?
Perkin5
 
Posts: 29
Joined: Sat Sep 03, 2011 10:36 am

Re: monokai theme

Postby agibsonsw on Thu Jan 03, 2013 12:26 am

By default, monokai doesn't have any PHP-colour coding, it uses generic scopes such as comment, keyword, etc..

You can add colours for PHP-specific scopes by creating new rules in the theme-file. In a PHP file use Ctrl-Alt-Shift-P and read the current scope in the status-bar. Better yet, install the plug-in ScopeHunter so that you can copy and paste.

Although the order doesn't matter in a theme file I would add your new rules after all the keyword, comment, etc., rules, but before it gets on to nonsense like C/C++, diffs. But OF COURSE copy the theme file first, give it a new name (filename and the name towards the top of the file) and amend the code-number at the bottom (uuid - even though this is not essential..).

The scopes that you uncover will generally be quite long and specific. Create the rules firstly using the full scope-text to prove that it works; but you can then consider abbreviating the scope so that it catches more of your code. (The precise order and words used in your scope-rules are not hugely important, as long as it is sufficient to record a higher score than any other rule.)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: monokai theme

Postby agibsonsw on Thu Jan 03, 2013 12:28 am

Here's an example:

Code: Select all
            <key>name</key>
            <string>Embedded PHP in HTML (functions)</string>
            <key>scope</key>
            <string>text.html.basic source.php.embedded.block.html support.function</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#FFFF00</string>
            </dict>
        </dict>
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: monokai theme

Postby Perkin5 on Fri Jan 04, 2013 6:07 pm

Many thanks for your help and it worked. I got the scope from Ctrl Alt Shift P having failed to make scopehunter work - so now I have a new problem!

Scopehunter installed successfully so I went to a document, positioned the cursor appropriately, pressed Ctrl Shift P, typed 'scope' and got two items:

Toggle instant scoper
Show scope under cursor

I clicked the latter and nothing happened. There seems to be zero documentation on this package and I suppose I'm being stupid but it didn't work for me. Any idea why?
Perkin5
 
Posts: 29
Joined: Sat Sep 03, 2011 10:36 am

Re: monokai theme

Postby agibsonsw on Fri Jan 04, 2013 6:10 pm

Were there any error messages in the Conole (Ctrl ' )? If you re-start ST it'll probably work ;)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: monokai theme

Postby agibsonsw on Fri Jan 04, 2013 6:12 pm

You could modify the following if it helps:

Code: Select all
      <dict>
         <key>name</key>
         <string>Embedded begin (PHP)</string>
         <key>scope</key>
         <string>text.html.basic source.php.embedded.block.html punctuation.section.embedded.begin.php</string>
         <key>settings</key>
         <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#FF0000</string>
         </dict>
      </dict>
      <dict>
         <key>name</key>
         <string>Embedded end (PHP)</string>
         <key>scope</key>
         <string>text.html.basic source.php.embedded.block.html punctuation.section.embedded.end.php</string>
         <key>settings</key>
         <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#FF0000</string>
         </dict>
      </dict>
      <dict>
         <key>name</key>
         <string>Embedded PHP in HTML double</string>
         <key>scope</key>
         <string>text.html.basic meta.tag.inline.any.html string.quoted.double.html source.php.embedded.line.html</string>
         <key>settings</key>
         <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#FF0000</string>
         </dict>
      </dict>
      <dict>
         <key>name</key>
         <string>Embedded PHP in HTML single</string>
         <key>scope</key>
         <string>text.html.basic meta.tag.inline.any.html string.quoted.single.html source.php.embedded.line.html</string>
         <key>settings</key>
         <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#FF0000</string>
         </dict>
      </dict>
        <dict>
            <key>name</key>
            <string>Embedded PHP in HTML (functions)</string>
            <key>scope</key>
            <string>text.html.basic source.php.embedded.block.html support.function</string>
            <key>settings</key>
            <dict>
                <key>fontStyle</key>
                <string></string>
                <key>foreground</key>
                <string>#FFFF00</string>
            </dict>
        </dict>
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: monokai theme

Postby Perkin5 on Fri Jan 04, 2013 6:45 pm

Thanks so much - yeah I was being stupid as usual. Restart fixed it.
Perkin5
 
Posts: 29
Joined: Sat Sep 03, 2011 10:36 am


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 21 guests