Skip to content
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

Acrylic background doesn't work if foreground is invisible #16271

Open
alabuzhev opened this issue Nov 6, 2023 · 7 comments
Open

Acrylic background doesn't work if foreground is invisible #16271

alabuzhev opened this issue Nov 6, 2023 · 7 comments
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Milestone

Comments

@alabuzhev
Copy link
Contributor

Windows Terminal version

Latest nightly

Windows build number

10.0.19045.3448

Other Software

No response

Steps to reproduce

  1. Enable background transparency and acrylic material in settings.
  2. Run the script below:
@echo off

echo �[1m bold�[m
echo �[2m faint�[m
echo �[3m italic�[m
echo �[4m underline�[m
echo �[9m strikeout�[m
echo �[53m overline�[m
echo �[5m blink�[m
echo �[7m inverse�[m
echo �[8m invisible�[m

pause

- where � is \x1b

Expected Behavior

image

Actual Behavior

image

- "Invisible" foreground causes the background to be fully opaque.

Looking at the code, it seems to be here:

// We only care about alpha for the default BG (which enables acrylic)
// If the bg isn't the default bg color, or reverse video is enabled, make it fully opaque.
if (!attr.BackgroundIsDefault() || (attr.IsReverseVideo() ^ GetRenderMode(Mode::ScreenReversed)) || attr.IsInvisible())

The || attr.IsInvisible() bit was added here:
https://github.com/microsoft/terminal/pull/12127/files#diff-0f336e9fd3608b43380ed0ad16fc625c4f1e2a681c70fc627f9df7239e1b6d54R252-R253

Looks like it wasn't in the original code:
https://github.com/microsoft/terminal/pull/12127/files#diff-f9112caf8cb75e7a48a7b84987724d754181227385fbfcc2cc09a879b1f97c12L90-L91

The change wasn't reflected in the comment / mentioned elsewhere in the PR (or at least I can't find it), so, is it intentional / a bug?

@alabuzhev alabuzhev added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 6, 2023
@j4james
Copy link
Collaborator

j4james commented Nov 7, 2023

It was an intentional fix for issue #11919, but I must have forgotten to reference it in the PR notes, and obviously that issue should also have been closed now.

The fact that it renders opaque with an acrylic background was a known compromise which I mentioned in #11919. Personally I kind of like the effect, but I also wouldn't care if someone wanted to make it fully transparent. That would likely be more complicated though.

@j4james
Copy link
Collaborator

j4james commented Nov 7, 2023

See also #7014.

@DHowett
Copy link
Member

DHowett commented Nov 7, 2023

I also wouldn't care if someone wanted to make it fully transparent.

I keep thinking about this - we could probably skip it in the renderer completely. The VtEngine would of course continue to produce it, but the actual graphical engines could ignore it and it would definitely appear to be concealed :laugh:

@alabuzhev
Copy link
Contributor Author

Thanks James.
Personally I don't really care how exactly it works, just reporting an inconsistency with other terminals:

image

Fully transparent could be beneficial at least for the sake of consistency and reducing the amount of WTFs/min (I thought there's a bug in my code somewhere).

@carlos-zamora carlos-zamora added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Product-Terminal The new Windows Terminal. Priority-3 A description (P3) and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 8, 2023
@carlos-zamora carlos-zamora added this to the Terminal v1.20 milestone Nov 8, 2023
@zadjii-msft
Copy link
Member

Pretty sure this is just a dup of #7014? Or, a more specific subset of that?

@alabuzhev
Copy link
Contributor Author

@zadjii-msft not really. Both are about transparency handling, but #7014 is about the text (when "reversed"), while this one is about the background (when "concealed").

@j4james
Copy link
Collaborator

j4james commented Dec 11, 2023

They are kind of related, in that the concealed background only lost its transparency in order to fix #11919, but if we had support for transparent text (via #7014), then #11919 could probably have been fixed by rendering both the foreground and background as transparent.

That said, I'm inclined to agree with @DHowett that skipping the rendering of concealed text entirely might be the best approach to take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

6 participants