1
1
mirror of https://github.com/wez/wezterm.git synced 2024-10-27 08:09:45 +03:00

docs: expand wezterm.format examples

refs: https://github.com/wez/wezterm/issues/3056
This commit is contained in:
Wez Furlong 2023-02-05 13:44:17 -07:00
parent 98c90215da
commit 0b2345a46f
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -30,7 +30,9 @@ wezterm.log_info(wezterm.format {
Possible values for the `FormatItem` elements are:
* `{Text="Hello"}` - the text `Hello`. The string can be any string expression.
* `{Text="Hello"}` - the text `Hello`. The string can be any string expression,
including escape sequences that are not supported directly by
`wezterm.format`.
* `{Attribute={Underline="None"}}` - disable underline
* `{Attribute={Underline="Single"}}` - enable single underline
* `{Attribute={Underline="Double"}}` - enable double underline
@ -47,3 +49,17 @@ Possible values for the `FormatItem` elements are:
* `{Background={AnsiColor="Black"}}` - set the background color to an ansi color as per `Foreground` above.
* `{Background={Color="blue"}}` - set the background color to a named color or rgb value as per `Foreground` above.
* `"ResetAttributes"` - reset all attributes to default. (*Since: 20220807-113146-c2fee766*)
This example shows how to use arbitrary escape sequences to change the underline color:
```lua
local wezterm = require 'wezterm'
wezterm.log_info(wezterm.format {
-- turn on underlines
{ Attribute = { Underline = 'Single' } },
-- make the underline red
{ Text = '\x1b[58:2::255:0:0m' },
-- and say hello
{ Text = 'hello' },
})
```