-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
ANSI/VT transparent and black background mismatch #3885
Comments
This sounds like #2661. |
Indeed, if colors are converted too early. Acrylic transparency should only happen when DEFAULT_BACKGROUND color is used, not when another color happens to have the same RGB value as the one selected as the background color, or the index selected as the background in the old console. |
The way it works is that default colors are indicated with a distinct type. So a color can either be default, an index, or an rgb value. You can see the terminal/src/buffer/out/TextColor.h Lines 42 to 47 in 429af0e
The narrowing problem, as I understand it, is that these color types are all first converted to a |
@j4james I'm concerned about the conversion to a COLORREF and optimization back to an index when the COLORRED matches a color of the palette though. This means we need to keep the original intent of the VT sequences, an index should never be converted to an RGB and an RGB should never be simplified into an index. Converting to COLORREF should be done just before rendering, as the palette might have been changed after the color codes have been output, and palette colors should always render using the current palette, not the palette from when they were received. |
Yes! That's exactly what issue #2661 is about! |
This specific case is actually tracked by /dupe #293. #2661 will help make sure we don’t narrow arbitrary colors into indexed ones, but 293 tracks the compatibility behavior of crushing the “default win32 console background” index (0) to “default VT background” (49). That’ll apply even in reverse video mode. |
Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! |
Tested on Windows Terminal 0.7.3382.0 from Store on Windows 10 1909 build 18363.476.
CUI App is my ActiveScript Shell, but only used because it makes it easy to send full strings to the Console API and JavaScript is easy for most to read, the problem seems to be with the rendering, or with the way conhost stores and retrieves cells colors.
ANSI VT has codes to set foreground and background colors, and codes to use default foreground and background colors (39, 49).
Windows Terminal has a nice transparency effect when the default background is used that makes it use Acrylic translucency.
The problem is that the terminal seems to lose track of what has been output as black (30 or 40) when it is the cell's background color and what has been output as default background color (49).
Writing something with a black background, using color 40 (or 30 and reversed using 7), the expectation is to have that color show as black, transparency should be achieved only by color 49.
This is important when doing ANSI-art and for consistency.
However, it seems the current implementation doesn't keep track of default colors 39 and 49, and instead assumes all cells with color 40 as their background to be the default background color or transparent, basically converting it to 49.
It also converts the other way around, using transparent (49) reversed should show the text as transparent, but instead converts it to black (30).
Let me know if my explanations aren't clear enough or if you really need a Win32 API repro.
The text was updated successfully, but these errors were encountered: