docs: Add dedicated pages for window_background_{opacity,image{,_hsb}}

This commit is contained in:
Benoit de Chezelles committed 2026-08-26 01:01:15 +02:00
1 parent 568f4ffadc
commit cdb33d39b1
11 files changed
+206 -83

No files matched your search

+9 -65
View File
@@ -451,48 +451,9 @@ reduce it by half, and 2.0 will double the value.
{{since('20201031-154415-9614e117')}}
You can attach an image to the background of the wezterm window:
```lua
config.window_background_image = '/path/to/wallpaper.jpg'
```
If the path is a relative path then it will be expanded relative
to the directory containing your `wezterm.lua` config file.
PNG, JPEG, GIF, BMP, ICO, TIFF, PNM, DDS, TGA and farbfeld files
can be loaded. Animated GIF and PNG files will animate while
the window has focus.
The image will be scaled to fit the window contents. Very large
images may decrease render performance and take up VRAM from the
GPU, so you may wish to resize the image file before using it.
You can optionally transform the background image by specifying
a hue, saturation, brightness multiplier:
```lua
config.window_background_image = '/path/to/wallpaper.jpg'
config.window_background_image_hsb = {
-- Darken the background image by reducing it to 1/3rd
brightness = 0.3,
-- You can adjust the hue by scaling its value.
-- a multiplier of 1.0 leaves the value unchanged.
hue = 1.0,
-- You can adjust the saturation also.
saturation = 1.0,
}
```
See [Styling Inactive Panes](#styling-inactive-panes) for more information
on hue, saturation, brightness transformations.
If you'd like to have control over scaling, tiling/repeating, scrolling
behavior and more, take a look at the more powerful
[background](lua/config/background.md) configuration option.
See [window_background_image](lua/config/window_background_image.md) and
[window_background_image_hsb](lua/config/window_background_image_hsb.md)
for configuration information on background images.
## Window Background Gradient
@@ -507,34 +468,17 @@ for configuration information on gradients.
{{since('20201031-154415-9614e117')}}
If your Operating System provides Compositing support then WezTerm is able to
specify the alpha channel value for the background content, rendering the
window background translucent (some refer to this as transparent rather than
translucent) and causing the windows/desktop behind it to show through the
window.
macOS, Windows and Wayland support compositing out of the box. X11 may require
installing or configuring a compositing window manager. XWayland under
Mutter/Wayland also works without any additional configuration.
`window_background_opacity` specifies the alpha channel value
with floating point numbers in the range `0.0` (meaning completely
translucent/transparent) through to `1.0` (meaning completely opaque).
Setting this to a value other than the default `1.0` may impact render
performance.
```lua
config.window_background_opacity = 1.0
```
See [window_background_opacity](lua/config/window_background_opacity.md)
for configuration information on opacity.
## Text Background Opacity
{{since('20201031-154415-9614e117')}}
When using a background image or background opacity, the image content can
have relatively low contrast with respect to the text you are trying to
read in your terminal.
When using a [background image](lua/config/window_background_image.md) or
[background opacity](lua/config/window_background_opacity.md), the image
content can have relatively low contrast with respect to the text you are
trying to read in your terminal.
The `text_background_opacity` setting specifies the alpha channel value to use
for the background color of cells other than the default background color.
+4 -4
View File
@@ -84,10 +84,10 @@ A source can be one of the following:
Specifying the following options:
* `window_background_gradient`
* `window_background_image`
* `window_background_opacity`
* `window_background_image_hsb`
* [window_background_gradient](window_background_gradient.md)
* [window_background_image](window_background_image.md)
* [window_background_opacity](window_background_opacity.md)
* [window_background_image_hsb](window_background_image_hsb.md)
will implicitly prepend a layer to the `background` configuration with width
and height set to 100%.
@@ -6,10 +6,11 @@ tags:
{{since('nightly')}}
*Deprecated; this option was added & deprecated in the same version. Use [wayland_window_background_blur](wayland_window_background_blur.md) instead*
*Deprecated; this option was added & deprecated in the same version.
Use [wayland_window_background_blur](wayland_window_background_blur.md) instead*
When combined with `window_background_opacity`, enables background blur
using the KDE Wayland blur protocol.
When combined with [window_background_opacity](window_background_opacity.md),
enables background blur using the KDE Wayland blur protocol.
This can be used to produce a translucent window effect rather than
a crystal clear transparent window effect.
@@ -6,14 +6,14 @@ tags:
{{since('20230326-111934-3666303c')}}
When combined with `window_background_opacity`, configures the blur radius
amount used by macOS when compositing the window on the screen.
When combined with [window_background_opacity](window_background_opacity.md),
configures the blur radius amount used by macOS when compositing the window on
the screen.
This can be used to produce a translucent window effect rather than
a crystal clear transparent window effect.
The screenshot below was achieved using this configuration:
```lua
config.window_background_opacity = 0.3
config.macos_window_background_blur = 20
@@ -4,8 +4,8 @@ tags:
---
# wayland_window_background_blur = false
When combined with `window_background_opacity`, enables background blur
using the Wayland background effect protocol.
When combined with [window_background_opacity](window_background_opacity.md),
enables background blur using the Wayland background effect protocol.
This can be used to produce a translucent window effect rather than
a crystal clear transparent window effect.
@@ -7,8 +7,8 @@ tags:
{{since('20230712-072601-f4abf8fd')}}
When combined with `window_background_opacity`, chooses from available
window background effects provided by Windows.
When combined with [window_background_opacity](window_background_opacity.md),
chooses from available window background effects provided by Windows.
The possible values for `win32_system_backdrop` are:
@@ -7,9 +7,10 @@ tags:
{{since('20210814-124438-54e29167')}}
Dynamically generates a `window_background_image` from the provided gradient
specification. When `window_background_gradient` is configured, the value
for `window_background_image` is ignored.
Dynamically generates a [window_background_image](window_background_image.md) from the provided
gradient specification.
When `window_background_gradient` is configured, the value for `window_background_image` is
ignored.
Linear gradients with vertical or horizontal orientation are supported:
@@ -0,0 +1,39 @@
---
tags:
- appearance
- background
---
# `window_background_image`
![Screenshot](../../../screenshots/wezterm-vday-screenshot.png)
{{since('20201031-154415-9614e117')}}
You can attach an image to the background of the wezterm window:
```lua
config.window_background_image = '/path/to/wallpaper.jpg'
```
If the path is a relative path then it will be expanded relative to the
directory containing your `wezterm.lua` config file.
PNG, JPEG, GIF, BMP, ICO, TIFF, PNM, DDS, TGA and farbfeld files can be
loaded. Animated GIF and PNG files will animate while the window has focus.
The image will be scaled to fit the window contents. Very large images may
decrease render performance and take up VRAM from the GPU, so you may wish to
resize the image file before using it.
You can optionally transform the background image with a hue, saturation,
brightness multiplier, for example, to darken a bright wallpaper so that text
remains readable.
See [window_background_image_hsb](window_background_image_hsb.md).
## Relationship with other options
The background image is ignored when
[window_background_gradient](window_background_gradient.md) is set.
To have control over scaling, tiling/repeating, scrolling behavior and more,
take a look at the more powerful [background](background.md) configuration
option.
@@ -0,0 +1,48 @@
---
tags:
- appearance
- background
---
# `window_background_image_hsb`
{{since('20201031-154415-9614e117')}}
Configures a Hue, Saturation, Brightness transformation that is applied to the
[window_background_image](window_background_image.md).
The transform works by converting the RGB values of the image to HSV values and
then multiplying the HSV by the numbers specified in `window_background_image_hsb`.
Modifying the hue changes the hue of the color by rotating it through the color
wheel.
_It is not as useful as the other components, but is available "for free" as part
of the colorspace conversion._
Modifying the saturation can add or reduce the amount of "colorfulness".
Making the value smaller can make it appear more washed out.
Modifying the brightness can be used to dim or increase the perceived amount of
light.
The range of these values is 0.0 and up; they are used to multiply the existing
values, so the default of 1.0 preserves the existing component, whilst 0.5 will
reduce it by half, and 2.0 will double the value.
```lua
config.window_background_image = '/path/to/wallpaper.jpg'
config.window_background_image_hsb = {
-- Darken the background image by reducing it to 1/3rd
brightness = 0.3,
-- You can adjust the hue by scaling its value.
-- a multiplier of 1.0 leaves the value unchanged.
hue = 1.0,
-- You can also adjust the saturation.
saturation = 1.0,
}
```
The same kind of transformation can be applied to monochrome glyphs with
[foreground_text_hsb](foreground_text_hsb.md).
@@ -0,0 +1,90 @@
---
tags:
- appearance
- background
---
# `window_background_opacity = 1.0`
{{since('20201031-154415-9614e117')}}
Specifies the alpha channel value for the window background.
If your Operating System provides compositing support, the window background
is rendered translucent (some refer to this as transparent rather than
translucent), causing the windows and desktop behind it to show through.
The value is a floating point number in the range `0.0` (completely
translucent/transparent) through to `1.0` (completely opaque), which is the
default.
```lua
config.window_background_opacity = 0.8
```
The opacity also applies to the
[window_background_image](window_background_image.md) and
[window_background_gradient](window_background_gradient.md) layers.
## Performance
Setting `window_background_opacity` to a value other than the default `1.0`
may impact render performance.
## Platform support
macOS, Windows and Wayland support compositing out of the box.
X11 may require installing or configuring a compositing window manager.
XWayland under Mutter/Wayland also works without any additional configuration.
On macOS, the window shadow is disabled automatically when the opacity is
set to less than `1.0`. You can re-enable it by adding `MACOS_FORCE_ENABLE_SHADOW`
to [window_decorations](window_decorations.md).
## Blur and backdrop effects
Opacity can be combined with operating system blur effects for a frosted
glass look rather than a crystal clear view of the desktop:
- [macos_window_background_blur](macos_window_background_blur.md)
- [wayland_window_background_blur](wayland_window_background_blur.md)
- [win32_system_backdrop](win32_system_backdrop.md)
For example, on macOS:
```lua
config.window_background_opacity = 0.3
config.macos_window_background_blur = 20
```
On Windows, you need to reduce the opacity below `1.0` for
`win32_system_backdrop` effects to work. For best results with the `"Mica"`
and `"Tabbed"` effects, set it to `0`.
With a backdrop effect you may want to raise the opacity of the non-default
background colors to keep text readable.
See [text_background_opacity](../../appearance.md#text-background-opacity).
## Toggling opacity at runtime
A common use case for opacity is to quickly peek at the desktop or another
window behind the terminal, and to toggle back to opaque for normal work.
```lua
return {
keys = {
{
key = 'o',
mods = 'CTRL',
action = wezterm.action_callback(function(window, pane)
local overrides = window:get_config_overrides() or {}
if not overrides.window_background_opacity then
-- no override yet, set the opacity
overrides.window_background_opacity = 0.5
else
-- else we override already, reset opacity to default from config
overrides.window_background_opacity = nil
end
window:set_config_overrides(overrides)
end)
},
},
}
```
+1 -1
View File
@@ -25,7 +25,7 @@ The value is a set of flags:
* `MACOS_FORCE_ENABLE_SHADOW` - enable the window shadow effect.
The window shadow effect is normally disabled by wezterm when the
[window_background_opacity](../../appearance.md#window-background-opacity) is set
[window_background_opacity](window_background_opacity.md) is set
to less than `1.0`.
{{since('20230408-112425-69ae8472', outline=true)}}