Terminus icon indicating copy to clipboard operation
Terminus copied to clipboard

Weird background on some text

Open saneef opened this issue 4 years ago • 17 comments

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?

saneef avatar Dec 09 '20 09:12 saneef

How did you set the TERM variable?

randy3k avatar Dec 09 '20 17:12 randy3k

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

randy3k avatar Dec 09 '20 17:12 randy3k

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 avatar Dec 09 '20 20:12 saneef

@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 avatar Dec 09 '20 20:12 saneef

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 avatar Dec 09 '20 23:12 saneef

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'

saneef avatar Dec 10 '20 00:12 saneef

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

randy3k avatar Dec 10 '20 05:12 randy3k

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

echo $TERM

randy3k avatar Dec 10 '20 05:12 randy3k

$ echo $TERM                                                                                                                                                
xterm-256color

saneef avatar Dec 10 '20 08:12 saneef

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":
	{
		...
	}
}

saneef avatar Dec 10 '20 08:12 saneef

$ echo $TERM                                                                                                                                                
xterm-256color

Even when you launched Sublime Text directly?

randy3k avatar Dec 10 '20 08:12 randy3k

Yes, in both cases it is xterm-256color

saneef avatar Dec 10 '20 08:12 saneef

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.

psychedelicious avatar Dec 21 '21 11:12 psychedelicious

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

randy3k avatar Dec 21 '21 12:12 randy3k

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?

benfrain avatar Jun 17 '22 12:06 benfrain

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).

PatTheMav avatar Dec 09 '22 16:12 PatTheMav