-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background is rendered improperly when specifying standard CSI code \033[40m #782
Comments
Ha! Interesting. I am putting this on the milestone of the 3.0 release. The best way to solve this is to start using a CSS preprocessor, in order to keep consistent colors across different points of the stylesheet. |
This was actually intentional so that you could see the black color on the background, I'm not opposed to changing it to #000 though. You would also want to change |
Deferring to unblock v3 |
I'm closing this off to keep out issue count lower as it hasn't gained any traction, is stale or is not worth tracking. |
This is still an issue, and there is no longer an obvious workaround using CSS. |
@jmwilkinson because your |
@Tyriar I don't follow.... what does that have to do with changing between black and bright black? Or with the default black background not matching the |
So I am almost certain there is a better way to do this, but in } else if(p == 40) {
bg = DEFAULT_ATTR && 0x1ff
} else if (p >= 41 && p <= 47) {
bg = p - 40;
} I do not know/couldn't find where |
@Tyriar Ok, that makes sense. What about the behavior of |
@jmwilkinson 40m does not reset the background to the default either, it sets the background to black. Use 0m or 49m to reset that. Also on resetting bold, the spec we work off says 22m does that and we do support that. |
@Tyriar The problem is that 40m is not black, it is grey. The default background color is black- I get this can be changed with theming so the default will not longer be black, but if black is used for the background it should be the same as the black used for 40m. It should be consistent. |
@jmwilkinson it was an intentional change to make the colors different in the default theme so they could be differentiated, they are different. The reason "default" is treated differently is because it could be black, white, anything, and terminal programs don't know if it's light or dark. |
@Tyriar I understand the distinction between "default" and explicitly using black. But if no theming is used, the default background is black. This should not be differentiated from 40m. It is not, as far as I am aware, differentiated in any other vt100 compliant terminal. There should not be a separate color "default black" as opposed to just "black". |
@jmwilkinson macOS' default terminal behaves the same as xterm.js. This is not some rule in a spec or anything but your personal preference, personally I think it's better to make them distinct because otherwise black background isn't emphasized at all when it is meant to be. Just change the theme in your implementation, easy fix. |
@Tyriar Ok, so according to ECMA 48 3rd edition, you are technically correct. The default background is "implementation defined", meaning it does not need to adhere to any of the other available colors, and can have an entirely separate color for the black background. That being said... Mac os does not behave like that. Nothing behaves like that. Still, if there is an easy way to change it without changing the internals of xtermjs, I am very interested in that. |
There are several reasons I'm resistant to change this:
Maybe I changed the background color to be a lighter black 🤔.
// Change the color of black
terminal.setOption('theme', {
black: '#000000',
brightBlack: '#000000'
}); I wouldn't be surprised if you didn't find this because our API documentation isn't that great. I normally refer people to the .d.ts file: Line 729 in 73ec8a8
|
@Tyriar I see what you're saying, but I think the benefits mentioned are mostly theoretical, and those benefits are outweighed by the notion of "least astonishment". Even for powershell I do not think the background uses a color outside the standard pallet for the default background... Ok, that being said... The theming option is really close, but is changing the font boldness for some reason. Is there a way to avoid that? |
@jmwilkinson that might be a bug, try changing experimentalCharAtlas to dynamic (if it's set as static). |
@Tyriar Well, no idea what that's doing, but the text remains in the bolded state, which keeps it consistent. It would be kind of nice to make it the lighter weight, but experimenting with |
@Tyriar Changing |
@jmwilkinson I can't seem to reproduce that? Can you reproduce it with a single echo -e like above? And does it reproduce if you switch rendererType to dom? If so you can inspect the DOM and see what attributes are being added. |
@Tyriar Sure, here you go. Also to be clear this is without a modification to the I also don't see this behavior at all when the renderer type is dom. |
Well there is something off comparing DOM renderer and the canvas renderer - at least the DOM currently does not care for the On code level this determines whether to do the bright shift:
They certainly do not the same thing. Question is - whats the right or intended behavior here? (Sorry for my ignorance, seems I cannot get it from the comments above.) @Tyriar Minor optimization idea - this bright shift correction could also be moved into |
Looks like we have an issue for it: #1773 |
Running the escape sequence
\033[40m
should set the background to a standard black. However, it results in a more grey background, which can be reset using\033[0m
.It looks as though the background color is being interpreted as "bright" rather than normal.
It appears to be due to https://github.com/sourcelair/xterm.js/blob/master/src/xterm.css#L229
This could be replaced with:
and it would behave as expected.
Details
Steps to reproduce
JS Fiddle
The text was updated successfully, but these errors were encountered: