mirror of
https://github.com/wez/wezterm.git
synced 2024-12-12 13:13:15 +03:00
41 lines
1.3 KiB
Markdown
41 lines
1.3 KiB
Markdown
# `wezterm.gui.get_appearance()`
|
|
|
|
*Since: 20220807-113146-c2fee766*
|
|
|
|
This function returns the appearance of the window environment. The appearance
|
|
can be one of the following 4 values:
|
|
|
|
* `"Light"` - the normal appearance, with dark text on a light background
|
|
* `"Dark"` - "dark mode", with predominantly dark colors and probably a lighter, lower contrasting, text color on a dark background
|
|
* `"LightHighContrast"` - light mode but with high contrast colors (not reported on all systems)
|
|
* `"DarkHighContrast"` - dark mode but with high contrast colors (not reported on all systems)
|
|
|
|
wezterm is able to detect when the appearance has changed and will reload the
|
|
configuration when that happens.
|
|
|
|
This example configuration shows how you can have your color scheme
|
|
automatically adjust to the current appearance:
|
|
|
|
```lua
|
|
local wezterm = require 'wezterm'
|
|
|
|
function scheme_for_appearance(appearance)
|
|
if appearance:find 'Dark' then
|
|
return 'Builtin Solarized Dark'
|
|
else
|
|
return 'Builtin Solarized Light'
|
|
end
|
|
end
|
|
|
|
return {
|
|
color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()),
|
|
}
|
|
```
|
|
|
|
### Wayland GNOME Appearance
|
|
|
|
wezterm uses [XDG Desktop
|
|
Portal](https://flatpak.github.io/xdg-desktop-portal/) to determine the
|
|
appearance in a desktop-environment independent way.
|
|
|