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

Background opacity not applied on explicit background color #1425

Closed
Mange opened this issue Dec 19, 2021 · 5 comments
Closed

Background opacity not applied on explicit background color #1425

Mange opened this issue Dec 19, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@Mange
Copy link

Mange commented Dec 19, 2021

What Operating System(s) are you seeing this problem on?

Linux X11

WezTerm version

wezterm 20211219-110753-48dd57ab

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

⚠️ I am unsure if this is a bug! I think this is a question of taste.

In some terminals, like for example Kitty, when background opacity is set it is applied to all cases of background color matching the theme's background color. When using 24-bit true color escape sequences, this might affect opacity.

To Reproduce

Enable window_background_opacity (to an excessive value to show the problem). Set background color to #1E1E29.

Print out text using that explicit background color.

clear; echo $'This uses the default background\n\e[48;2;30;30;41mThis uses the same explicit background\n\e[0mThis uses the default background'

Configuration

local wezterm = require "wezterm"

return {
  window_background_opacity = 0.5,
  color_scheme = "Catppuccino",
  color_schemes = {
    -- https://github.com/catppuccin/catppuccin/issues/17
    Catppuccino = {
      background = "#1E1E29",
    },
  },
}

Expected Behavior

The section with the same background color as the terminal's background should use transparent background.

Logs

No response

Anything else?

Screenshot from Wezterm:

image

Screenshot from Kitty:

image

@Mange Mange added the bug Something isn't working label Dec 19, 2021
@wez
Copy link
Owner

wez commented Dec 20, 2021

@wez wez added the waiting-on-op Waiting for more information from the original poster label Dec 22, 2021
@Mange
Copy link
Author

Mange commented Dec 22, 2021

Not quite right. Here I'm experimenting with window_background_opacity = 0.0.

text_background_opacity = 1.0 (default):

image

text_background_opacity = 0.0

image

The red background disappears too as text_background_opacity is for all background colors, not just the terminal background color.

@no-response no-response bot removed the waiting-on-op Waiting for more information from the original poster label Dec 22, 2021
@wez
Copy link
Owner

wez commented Dec 22, 2021

The behavior isn't a bug, it's just different from Kitty :)
In wezterm, we classify the background color like this:

  • If the background attribute is set to default, then we use window_background_opacity
  • Otherwise, we use text_background_opacity

If an application requests that the background be an explicit true color value or an explicit palette index we respect that and use it: it is distinctly different from setting the background color attribute to default.

@Mange
Copy link
Author

Mange commented Dec 22, 2021

Cool! Great to know. :-)

(I agree on this particular taste. I've adjusted all my scripts to emit explicitly default background instead when I want it to be transparent.)

@Mange Mange closed this as completed Dec 22, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants