mihnita / ansi-econsole

Eclipse plugin that understands ANSI escape sequences to color the Eclipse console output.
http://www.mihai-nita.net/java/
Other
90 stars 25 forks source link

Do not use black foreground if unstyled #15

Closed smee closed 6 years ago

smee commented 9 years ago

The ANSI console seems to use black from its pallette whenever the escape code regular expression does not match. This means that the default color for outputs is always black. I use a dark theme in Eclipse and this behaviour makes text pretty much unreadable.

Suggestion: Do not use black as default color when there are no ANSI codes in effect (either per default or as a configuration option) but rather use the default text foreground color.

mihnita commented 9 years ago

Hi,

Thank you both, smee for taking the time to report it, and laurentpetit for contributing a patch. I am very happy that there are some people out there that like it enough to take the time and help :-) I will definitely take it, and fix this. But I would really like to reproduce this issue, and make sure it does not break something else. And until now I could not, everything works fine with my configuration...

I am using a dark theme myself (in fact, you can see that the screen-shot in marketplace is done on a "dark eclipse"). I use my own "recipe" on top of the jeeeyul's plugin, built long ago, before there was an official dark theme in Eclipse (http://mihai-nita.net/2013/09/19/dark-eclipse/)

What are you using? I have used the plugin with my theme, the Moonrise theme, and the official dark theme in Eclipse Mars. Running on Win, Mac and Ubuntu. And I did not see any problems.

I have some suspicion that there is some conflict between some of the themes out there and the console colors (http://mihai-nita.net/wp-content/uploads/2013/09/ColorPickUbuntu.png)

If the Console settings are not changed, and the theme only overrides the background, that's a problem. Not only that the foreground text will be wrong, but at times I some expect artifacts, even without my plugin.

My plugin honors the console settings, and I don't think there is a way to retrieve the background from the theme. Even if null will solve the background problem in normal mode (in fact, I've been on that path myself at some point :-), it will still need that info for the "negative" and "conceal" modes, where I need to use the background color for foreground. So I need to take that info from somewhere.

So, can you please:

Thank you very much, Mihai

smee commented 9 years ago

Hi Mihai,

thanks for taking your time. Actually, the problem is not in the standard Eclipse console view but rather in the REPL view of the Clojure IDE CCW (https://github.com/laurentpetit/ccw/issues/834). I use Eclipse 4.5, installed CCW from http://doc.ccw-ide.org/, installed Ansi Console from the Eclipse Market (v1.3.0.201404020252), Eclipse Moonrise UI Theme (v0.8.9.201404052318) and finally Eclipse Color Theme (v1.0.0.20140260308)

Here is a screenshot of the "Installed Software" view: image

The effect described in this bug report can be seen here: image. Is there any other information I could give you?

mihnita commented 9 years ago

For now a workaround for the users would be to set the colors in the standard console to be the same as the ones in the REPL console. (Preferences -- Run/Debug -- Console)

It looks like null means "use the theme color", and that can be different from the console one. I am not sure of a good fix yet. You can't honor both the standard console, and the theme settings in the same time.

  1. One idea would be to detect the current console and do different things. But that would mean becoming aware of all kind of possible consoles. And potentially honoring their own custom settings (it they have any). And keeping track of their versions (if the REPL console adds color settings then the plugin would have to do different things for different versions of the REPL console)
    I think this is not a good option...

    1.1. A variant would be to add color settings in the plugin for various consoles. That way a user can specify the default foreground / background color for each console type. And the user is supposed to remember to keep in sync the colors in the console proper with the ones in the plugin... Kind of been there in the beginning (I had a setting for the standard one).

  2. Another option would be to do one thing if I detect I am in the standard console, and use null (the theme) for any other console. With the risk that it is the wrong thing for consoles that use the same colors as the standard console, or that have their own preferred settings.
    I don't like this too much either...
  3. Expose some kind of API to allow other consoles to provide their own background / foreground default colors. Not sure how many console writers would chose to call this, but it is an option.
  4. Recommend that other console use the same color as the standard console. After all, it is very likely that I want all my consoles the same color. But maybe that's the wrong assumption. Maybe there is a console for very important monitoring software, and I want red background for that one...
  5. File a bug with Eclipse to make null mean "default foreground color" in the console. That is in fact the behavior for the background color (if I remember well)! I have struggled with this for a long time, in fact.

Overall, not sure of a good solution. If you can think of something, I am very interested. But unfortunately I can't take the current patch "as is"

smee commented 8 years ago

Thanks for your participation, Mihai. My own knowledge about Eclipse internals is quite limited, so I'm afraid I can't offer a profound opinion about this issue. Hopefully @laurentpetit can give his point of view?

laurentpetit commented 8 years ago

Hello @mihnita , @smee

@mihnita , well, maybe I should talk a little bit more about how I'm trying to use ansi-econsole: actually, it's only the ansi part I'm interested in. Not the console part. Just trying to have ansi colors in a StyledText. Not presuming at all if this StyledText semantically represents a console, or whatever.

Maybe I'm picking the wrong abstraction inside ansi-econsole plugin. Maybe the ansi-colors part and the econsole colors parts can be decoupled more to make the default choice colors more configurable. I don't know. Haven't looked at the code in a while.