jkaving / intellij-colors-solarized

Solarized Colorscheme for IntelliJ IDEA
3.26k stars 428 forks source link

Different background color on PhpStorm 9 EAP #95

Closed aik099 closed 9 years ago

aik099 commented 9 years ago

I've tried PhpStorm 9 EAP for a change and it's something wrong with background color (too light) in there. Could be bug in PhpStorm 9 EAP. I've reported there too: https://youtrack.jetbrains.com/issue/WI-26895

PhpStorm 9 EAP: phpstorm_9_solarizeddark

PhpStorm 8: phpstorm_8_solarizeddark

jkaving commented 9 years ago

After reading the linked YouTrack issue this doesn't seem to be a problem with the color scheme, but rather something with settings migration in PhpStorm.

Or do you think there is something that needs to be fixed in the color scheme?

aik099 commented 9 years ago

Seems so.

aik099 commented 9 years ago

Please reopen, because I've found where the issue was. Apparently you're OSX user, as am I and that might have caused some interpretation difference of UI changes.

There is a setting in Color Scheme called Template Language. On OSX only there was a bug (see https://youtrack.jetbrains.com/issue/WI-27766) that caused that color not to apply as editor background, when editing PHP files. On Linux/Windows it was always applied.

phpstorm_templatelanguagecolorsetting

What is correct background color of the editor: darker one (as on screenshot of OSX PhpStorm 8) or lighter one (as on screenshot of OSX PhpStorm 9).

jkaving commented 9 years ago

I don't quite understand what you want to change. The Solarized theme sets the "Template language" background color to base2/base02 so that it is different from the regular background color of base3/base03.

Do you suggest changing it to be the same as the regular background color? As I commented in #101 I don't see this behavior on a fresh install of PhpStorm 9 and the Solarized theme.

aik099 commented 9 years ago

Do you suggest changing it to be the same as the regular background color?

Yes, by checking "inherit from" checkbox, not by specifying same color.

jkaving commented 9 years ago

But that would remove the "Template language" function everywhere, and just make it have the normal background color.

aik099 commented 9 years ago

I'm not sure what exactly Template language function is. For me it's just setting that color across all PHP file, but not JS/CSS file for example. That's why I think it's something incorrect.

jkaving commented 9 years ago

Are you sure the color scheme in you PhpStorm settings is the same as in this repo? (I'm not seeing the problem with a fresh install)

Could you copy the Solarized Dark.icls file from the repo into your ~/Library/Preferences/WebIDE90/colors directory (perhaps renaming it first to not overwrite the one you have now). Do you still see the problem?

aik099 commented 9 years ago

I've just opened default theme in PhpStorm 8 on Windows 7 to demonstrate what the problem is: phpstorm8_onwindows_templatelanguage

I hope now it's clearly visible where Template Language goes into interface. And this wasn't working like this on OSX until PhpStorm 9 was released. Before I had white background (default color) and Template Language color was ignored.

aik099 commented 9 years ago

Real magic. I've tried Solarized theme (fresh jar file download from GitHub) on PhpStorm 8 and PhpStorm 9 on Windows and proper background color is used regardless of what's been set as Template language color.

So yes, I'm suggesting we set Template language color to default/inherit on both themes (dark & light).

jkaving commented 9 years ago

Ok, I think I might understand what causes this.

PHP is considered a template language, since it can typically be used like this:

<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
echo "Hello World!";
?>

</body>
</html>

(Example taken from http://www.w3schools.com/php/php_syntax.asp)

To make the code parts of a template file stand out the background color for "Template language" is set to be slightly different than the default background color (both in the default color scheme and in Solarized). So the parts within <?php and ?> will get the different background color.

In the Solarized color scheme all "PHP" elements inherit the background from "Language Defaults". So e.g. "Identifier" in "PHP" inherits from "Identifier" in "Language Defaults". And "Identifier" in "Language Defaults" doesn't specify a background color, but inherits from "Default text" in "General". And "Default text" in "General" is where we specify the default background color.

So I wonder whether the problem is that the background color for identifiers etc. (the one from "Default text") overrides the background color in "Template language".

What I don't understand is why I don't get this problem.

@aik099 - Do you see the same problem when you use the default color scheme?

aik099 commented 9 years ago

Amazing research. Yes, I do see same problem in Default theme. Here are screenshots from both:

phpstorm9_mac_solarized_templatelanguage phpstorm9_mac_default_templatelanguage

And when it's pure PHP file so 100% template language I'm getting lighter background. So I guess it's what PhpStorm wanted, but I doubt that it's good idea to use that Template Language having different colors feature in Solarized colors.

jkaving commented 9 years ago

I agree that this feature is a problem if you are writing PHP code that is pure PHP and not part of an HTML page. But on the other hand you might just as well be writing HTML pages with small parts of PHP embedded and find it useful to easily discern these using the different background color.

What does it look like for you if you use the default color schemes and open the file in your original description. Because the problem there is that there are two different background colors within the PHP code. Do you get the same with the default color schemes?

aik099 commented 9 years ago

But on the other hand you might just as well be writing HTML pages with small parts of PHP embedded and find it useful to easily discern these using the different background color.

Not the case for me, because I'm using templating engine and considering feature of mixing PHP and HTML code rather harmful as resulting code is hard to maintain/read.

What does it look like for you if you use the default color schemes and open the file in your original description.

phpstorm9_mac_defaultcolorscheme

I guess default background for all PHP-based symbols is set to light blue and that's why it doesn't look as bad as it happens with Solarized Dark.

Do you get the same with the default color schemes?

Nope, see above screenshot.

jkaving commented 9 years ago

I just installed the EAP version of IntelliJ IDEA 15 Ultimate Edition, installed the PHP plugin, and now I see the problem screenshot of intellij idea-eap 2015-07-17 13 44 13

It is even more obvious in Solarized Light: screenshot of intellij idea-eap 2015-07-17 14 05 35

The difference might be that PhpStorm 9.0 is still running Java 6 and IDEA 15 is a custom-built version of Java 8 (which solves the problem discussed in #46).

jkaving commented 9 years ago

I didn't see you comment above before I wrote mine (the real job got in the way :-))

I guess default background for all PHP-based symbols is set to light blue and that's why it doesn't look as bad as it happens with Solarized Dark.

This sounds plausible so I decided to check.

What I found was that it is actually simpler than that. The difference between Solarized and the default theme is that "Language Defaults" -> "Identifier" doesn't inherit from "General" -> "Default text" in the default theme. It just specifies the same foreground color and no background color.

Changing Solarized to do the same seems to fix the problem.

Thanks for helping get to the bottom of this!

aik099 commented 9 years ago

I just installed the EAP version of IntelliJ IDEA 15 Ultimate Edition, installed the PHP plugin, and now I see the problem

Ha, then the PHP plugin did that stuff.

Changing Solarized to do the same seems to fix the problem.

Any PR/commit coming?

Thanks for helping get to the bottom of this!

You're welcome.

aik099 commented 9 years ago

Works like a charm, thanks. Am I correct, that originally described problem was fixed (the editor background was lighter than needed)?

jkaving commented 9 years ago

Well, PHP code will still be lighter, because it is considered a "Template language". But now the identifiers etc. will have the same background. If you want to have the default background color for PHP code you will need to change the setting for "Template language".

aik099 commented 9 years ago

That's what I thought from looking at changed parts of the icls files.