Open fdncred opened 1 month ago
vscode
windows terminal
There are also some subtle differences in vscode dark mode. I guess it is not to select the existing color, but to make the text color semi-transparent if the two colors are similar. Maybe this requires looking at the source code of vscode or Windows terminal.
I think you've found a bug in WT and VSCode Terminal. 49 is definitely a background color just like 46, 45, and 44, so the background should be light with dark text.
But I agree that the 47 and 30 rendering is weird in VSCode Terminal. 30 should be invisible on a black background, so WT looks right in that instance. I think WT is right on 47 too because it's supposed to be white background with white text, so the text should be invisible in this instance. I've definitely read reports about vscode's xterm.js terminal acts wonky sometimes.
Interestingly, only the vscode terminal will display text, maybe there is a magical configuration like raw-ansi that controls this behavior
@fdncred
hi, can you provide a specific test case and expected output? It seems that ansi2 may need to add a custom color table to support different theme colors
cat ./color.ans | ansi2 --colors=#000000,#800000,#008000,#808000,#000080,#800080,#008080,#c0c0c0,#808080,#ff0000,#00ff00,#ffff00,#0000ff,#ff00ff,#00ffff,#ffffff > color.svg
Here's a color table I created a long time ago. colortable.ans.txt
This one is a little crazy but has defaults in it too. sample.ans.txt This one is too large for me to capture a screenshot because it shows all colors fg, bg, and styles
Here's one with just the defaults that nushell supports. Looks like ghostty doesn't support bg 49 either. ansi_default.ans.txt
The point of default is that your terminal knows what text color contrasts well with your background color. So, on light terminals the text is dark and on dark terminals the text is light. I'm not sure exactly how it works because it's not necessarily index 0 (black) or 15 (white) for the color. On Dark Solarized, which has a kind of green background, it chooses a gray color, which is index 10, 11, or 12. I can submit another issue on this subject. Thanks.
The way I test this in nushell is to set my terminal to any dark theme and do this command.
This also works.
Then I switch my terminal theme to any light colored theme and repeat the test.
Here it is in Solarized Dark
Here it is for AtomOneLight
Here it is for the Wez theme