O
O
OwerFan2020-05-24 23:06:03
Sublime Text
OwerFan, 2020-05-24 23:06:03

How to change echo color?

The echo in the php code has a certain color, how can I change it to red?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hitsmart, 2020-05-27
@OwerFan

To quickly open resources, you need to install the PackageResourceViewer plugin.
If you open the PHP extension syntax description file:
Ctrl+Shift+P -> PackageResourceViewer:Open Resource -> PHP -> PHP.tmLanguage
You can find the following code there:

<dict>
  <key>match</key>
  <string>(?i)\b(print|echo)\b</string>
  <key>name</key>
  <string>support.function.construct.php</string>
</dict>

The code defines a regular expression and sets its "name" value to "support.function.construct.php" (this value is specified as "scope" in the color scheme file).
Then open the file of the current color scheme for editing (for example, the standard Monokai scheme):
Ctrl+Shift+P -> PackageResourceViewer:Open Resource -> Color Scheme - Default -> Monokai.tmTheme
And find the style block there for scope equal to "support.function ":
<dict>
  <key>name</key>
  <string>Library function</string>
  <key>scope</key>
  <string>support.function</string>
  <key>settings</key>
  <dict>
    <key>fontStyle</key>
    <string></string>
    <key>foreground</key>
    <string>#66D9EF</string>
  </dict>
</dict>

To set a special style for the print and echo functions, you can add a similar block but with scope equal to support.function.construct.php (it is specified in PHP.tmLanguage). Or you can create a new scope just for the "echo" function and style it in the color scheme file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question