I’ve long preferred working in light-text-on-dark-background editing environments. However, Zend Studio’s Dark Theme presented one problem for me, until I discovered the Annotations Preferences settings. Now, I’m happy again!
How would you like to go from this (“Argh! I can’t see the variable name!”)…
… to this?
These highlights show all occurrences in a script of the variable the cursor is in, distinguishing between “read occurrences” and “write occurrences”. An example of a read occurrence is when a variable appears in an expression on the right-hand side of an assignment operator (i.e., the value is “read”). Write occurrences exist when the variable is given a value, for example by appearing on the left-hand side of the assignment operator, or by appearing in a function/method parameter list.
The default settings work much better in light themes than a dark one (see the first image above), but it turns out it’s easy to change.
First, go to Window | Preferences (On OSX, Zend Studio | Preferences):
Type annotations in the Search filter field in the upper left or navigate to General | Editors | Text Editors | Annotations:
In the center of the dialog box, under the list of Annotation types, select PHP elements ‘read’ occurrences. Then, from the select list on the right next to Text as, choose one of the options, and click OK (Apply didn’t seem to make the changes immediately visible).
Here’s what choosing Box looked like for me. Note we’ve changed only what a read access of the variable (the part inside the string) looks like:
Below, we change the annotation to a box, and the annotation’s color, this time for PHP elements ‘write’ occurrences’:
And here are the results, with default-colored boxes around read occurrences, and rose-colored boxes around write occurrences:
Play around with the various annotation methods (box, dashed box, highlight, etc.) and colors, until you find a combination you like. Here are green highlights for read occurrences, and red highlights for write accesses:
This last one is growing on me quickly; I think I’ll keep it!