Why these 2 PHP files have different background colors and how do I change that?

Two similar PHP files, file-1.php and file-2.php, in the same directory have different background colors.
The one of File-2 is lighter and I would like it to be the same as the dark File-1 one.

For some reasons the bg color changed after an upgrade to the new version 2023.2.1. 
I'm now using 2023.2.2 but it's still that light bg color.
I tried to change color settings, reset to Scheme default, close and reopen files …

Why these 2 PHP files have different background colors and how do I change that?  (all to File-1 dark bg)
 

0
4 comments

Hi,

Is there any chance one of these files has a closing PHP tag?

1

Hi,

It seems you pointed to the right direction.

Indeed a tiny JS portion sets variables.

But shouldn't the inversion of bg color be reversed? I mean, the lighter part being the JS code, not the opposite?
Adding the `?><?php` tags makes suddenly the whole file lighted?!

Of course I could simply use the Heredoc operator or echo the lines.
But I find it easier to read and maintain this way.

0

Thank you for the update.

There is a specific background color for PHP code but by default, it is disabled when file has only one PHP code section, this behaviour is controllable via the “Settings/Preference | Editor | General | Appearance > Always enable PHP code background highlighting”.

In any way, you may change the PHP background color in “Settings/Preferences | Editor | Color Scheme | PHP > PHP Code > Background”.
 

1

Thanks, changing the bg color specifically for PHP does works.

I find it unfortunate to have to break the “inherit” defaults though, to set a specific color .
And the logic: because of these 2 lines closing and reopening the PHP tag, 99% of the  remaining code is “highlighted” …

Anyway for now I'll keep the bg color hardly coded - maybe in the future I'll remove these tags.

0

Please sign in to leave a comment.