xplr/docs/en/src/style.md

88 lines
1.2 KiB
Markdown
Raw Normal View History

2021-10-16 03:03:56 +00:00
# Style
A style object contains the following information:
- [fg][1]
- [bg][2]
- [add_modifiers][3]
- [sub_modifiers][4]
### fg
Type: nullable [Color][5]
The foreground color.
### bg
Type: nullable [Color][5]
The background color.
### add_modifiers
Type: nullable list of [Modifier][6]
Modifiers to add.
### sub_modifiers
Type: nullable list of [Modifier][6]
Modifiers to remove.
2021-10-16 03:03:56 +00:00
## Color
Color is a [sum type][7] that can be one of the following:
- "Reset"
- "Black"
- "Red"
- "Green"
- "Yellow"
- "Blue"
- "Magenta"
- "Cyan"
- "Gray"
- "DarkGray"
- "LightRed"
- "LightGreen"
- "LightYellow"
- "LightBlue"
- "LightMagenta"
- "LightCyan"
- "White"
- { Rgb = { int, int, int } }
- { Indexed = int }
2021-10-16 03:03:56 +00:00
## Modifier
Modifier is a [sum type][7] that can be one of the following:
- "Bold"
- "Dim"
- "Italic"
- "Underlined"
- "SlowBlink"
- "RapidBlink"
- "Reversed"
- "Hidden"
- "CrossedOut"
2021-10-16 03:03:56 +00:00
## Example
```lua
xplr.config.general.prompt.style.fg = "Red"
xplr.config.general.prompt.style.bg = { Rgb = { 100, 150, 200 } }
xplr.config.general.prompt.style.add_modifiers = { "Bold", "Italic" }
xplr.config.general.prompt.style.sub_modifiers = { "Hidden" }
```
2021-10-16 03:03:56 +00:00
[1]: #fg
[2]: #bg
[3]: #add_modifiers
[4]: #sub_modifiers
[5]: #color
[6]: #modifier
[7]: sum-type.md