randy3k / Terminus

Bring a real terminal to Sublime Text
https://packagecontrol.io/packages/Terminus
MIT License
1.4k stars 82 forks source link

Weird background on some text #256

Open saneef opened 3 years ago

saneef commented 3 years ago

I'm using Fish shell with Terminus. Within Terminus some text comes with weird background color, especially auto suggestions in fish.

Screenshot 2020-12-09 at 2 36 19 PM

Looks like it is similar to the 'Terminal panel background issue' in the README, but I'm not using DA UI.

Is there any fix for this on Terminus, or Fish shell side?

randy3k commented 3 years ago

How did you set the TERM variable?

randy3k commented 3 years ago

By the way, what themes are you using in ST and Terminus?

saneef commented 3 years ago

Theme for Terminus

I'm manually setting variables in Terminus settings. Because, choosing theme from Terminus don't change the background color. It stays as a dark color always. 😢 I tried restarting like mentioned in #230; no luck.

{
  "256color": false,
  "theme": "default",
  "unix_term": "xterm-256color",
  "user_theme_colors": {
    "background": "#fdf6e3",
    "black": "#002831",
    "blue": "#2176c7",
    "brown": "#a57706",
    "caret": "#9cc2c3",
    "cyan": "#259286",
    "foreground": "#657b83",
    "green": "#6cbe6c",
    "light_black": "#006488",
    "light_blue": "#178ec8",
    "light_brown": "#b27e28",
    "light_cyan": "#00b39e",
    "light_green": "#51ef84",
    "light_magenta": "#e24d8e",
    "light_red": "#f5163b",
    "light_white": "#fcf4dc",
    "magenta": "#c61c6f",
    "red": "#d11c24",
    "white": "#eae3cb"
  }
}

ST

Theme

Using "Default"

Screenshot 2020-12-10 at 1 52 16 AM

Color Scheme

Solarized (light), slightly modified.

saneef commented 3 years ago

@randy3k Sorry, It was my mistake.

{
  "256color": false, // 😔 was setting to 'false' instead of 'true'
  ...
}

Changing to true fixed the problem.

Also, the background problem, I mentioned above, vanished too. I changed ST Color Scheme and Theme to another one, then set theme back to the one I use. No idea what exactly was the problem.

saneef commented 3 years ago

I could reproduce the above problem even with { "256color": true, "unix_term": "xterm-256color", ...}. I'm using Sublime Text 3 on macOS.

  1. Problem appears when launched from terminal (iTerm2) using subl or subl <path>.
  2. Works fine when Sublime Text is launched using "Sublime Text.app" from finder or spotlight.
saneef commented 3 years ago

I suspect this is due to the difference value in TERM variable.

Launched using subl from terminal

From Sublime Console:

>>> import os
>>> os.popen('echo $TERM').read()
'xterm-256color\n'

Launched using 'Sublime Text.app'

>>> import os
>>> os.popen('echo $TERM').read()
'dumb\n'
randy3k commented 3 years ago

you also need to edit the setting unix_term in the settings.

randy3k commented 3 years ago

You shouldn't just inspect the $TERM variable in the Sublime Console. Try printing the $TERM variable in your shell.

echo $TERM
saneef commented 3 years ago
$ echo $TERM                                                                                                                                                
xterm-256color
saneef commented 3 years ago

you also need to edit the setting unix_term in the settings.

This is how I have configured.

{
    "256color": true,
    "theme": "user",
    "unix_term": "xterm-256color",
    "user_theme_colors":
    {
        ...
    }
}
randy3k commented 3 years ago
$ echo $TERM                                                                                                                                                
xterm-256color

Even when you launched Sublime Text directly?

saneef commented 3 years ago

Yes, in both cases it is xterm-256color

psychedelicious commented 2 years ago

I just ran into this issue or something like it while using the Monokai Pro ST Theme, Color Scheme, and Terminus theme. I have ..."256color": true, "unix_term": "xterm-256color"... in my Terminus user settings, and echo $TERM -> xterm-256color.

Screen Shot 2021-12-21 at 10 00 24 pm

As far as I can tell, Terminus is only applying the correct background colour from the Terminus theme to characters which have a color != foreground. All other characters and space in the terminal have the ST theme's background PNG texture.

I copied the Monokai Pro theme to the Terminus user settings, set my theme to user, and then set "background": "rgba(0, 0, 0, 0)". Now at least the background colours are consistent (though not correct).

Edit: I think that setting the RGBA value doesn't actually work, it just causes some problem and the background colour isn't parsed correctly. So instead, I've just set background to be the same colour as the ST theme's PNG texture.

Any suggestions to get the correct background colour? Thanks.

randy3k commented 2 years ago

See this bug https://github.com/SublimeTextIssues/Core/issues/817 Terminus has a workaround for web color https://github.com/randy3k/Terminus/blob/b9f68ab8f4b3476f81f55c727574393feecf7992/tools/theme_generator.py#L65

benfrain commented 2 years ago

I'm seeing the same issue (I think). Also using Monokai Pro, p10k. Have this in my settings:

{
    "256color": true,
    "unix_term": "xterm-256color",
}

Little unclear from @randy3k last comment - is there something I can change to get the backgrounds consistent?

PatTheMav commented 1 year ago

As a small heads-up for those that use base16-shell or similar methods to set an extended colour-range in their terminals, it seems that Terminus does not support setting colours this way.

base16-shell sets 8 base colours, sets the bright variant to the same values and adds another 6 colours as "accent" colours, which can then be picked up by e.g. vim.

Without this, the accent colours are set in the "bright" colour range between bright black and bright white, but then obviously require base16 colour schemes that are aware of that (i.e. vim themes can work with both variants).

Even setting 256color to true and unix_term to xterm-256color seems to result in default ANSI-colours being used (which are then transformed into colours from the current Sublime theme), any colour "outside" this range yields unexpected results (in my case, bold characters in the "accent" colour range get a white background instead).

anks2k commented 5 months ago

So all this for nothing, I was able to rectify this issue after several tries with

{
    "color_scheme_tint": "",
    "class": "text_output_control"
}

This is a rule in the Theme Settings file.