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?
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?
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.)
Here’s an example:
<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>
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?
Were there any error messages in the Conole (Ctrl ’ )? If you re-start ST it’ll probably work
You could modify the following if it helps:
<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>