Skip to content

Commit 317bff3

Browse files
Change order of AnsiColorPair to u8. Need to change it upstream.
Add docs, initial format. Signed-off-by: Toria <ninetailedtori@uwu.gal>
1 parent 4ec3e08 commit 317bff3

File tree

2 files changed

+74
-2
lines changed

2 files changed

+74
-2
lines changed

docs/src/content/docs/reference/context-variables.mdx

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ These types are designed to closely match the
7474
- **Description**: A map of color identifiers to their respective values.
7575
- **Type**: `Map<String,`[`Color`](#color)`>`
7676

77+
### `ansi_colors` {#flavor-ansi}
78+
79+
- **Description**: A map of color identifiers for the ANSI terminal to their respective values.
80+
- **Type**: `Map<String, `[`AnsiColor`](#ansi)`>`
81+
82+
### `ansi_color_pairs` {#flavor-ansi-pairs}
83+
84+
- **Description**: A map of color identifiers (without brightness modifier) for the ANSI terminal to their respective pairs.
85+
- **Type**: `Map<String, `[`AnsiColorPair`](#ansi-pair)`>`
86+
7787
### Color
7888

7989
#### `name` {#color-name}
@@ -84,7 +94,7 @@ These types are designed to closely match the
8494

8595
#### `identifier` {#color-identifier}
8696

87-
- **Description**: The identifier of the color.
97+
- **Description**: The lowercase identifier of the color.
8898
- **Type**: `String`
8999
- **Examples**: `"rosewater"`, `"surface0"`, `"base"`
90100

@@ -139,6 +149,68 @@ These types are designed to closely match the
139149
- **Type**: `u8`
140150
- **Examples**: `0` to `255`
141151

152+
### `AnsiColor` {#ansi}
153+
154+
#### `name` {#ansi-name}
155+
156+
- **Description**: The name corresponding to the ANSI terminal color.
157+
- **Type**: `String`
158+
- **Examples**: `Black`, `Green`, `Magenta`, `Cyan`, `Bright Red`, `Bright Yellow`, `Bright Blue`, `Bright White`
159+
160+
#### `identifier` {#ansi-identifier}
161+
162+
- **Description**: The lower camel_case identifier of the ANSI terminal color.
163+
- **Type**: `String`
164+
- **Examples**: `black`, `green`, `magenta`, `cyan`, `bright_red`, `bright_yellow`, `bright_blue`, `bright_white`
165+
166+
#### `code` {#ansi-code}
167+
168+
- **Description**: The ANSI terminal escape code corresponding to the color.
169+
- **Type**: `u8`
170+
- **Examples**: `0` to `15`
171+
172+
#### [`hex`](#color-hex)
173+
174+
#### [`int24`](#color-int24)
175+
176+
#### [`uint32`](#color-uint32)
177+
178+
#### [`sint32`](#color-sint32)
179+
180+
#### [`rgb`](#color-rgb)
181+
182+
#### [`hsl`](#color-hsl)
183+
184+
### `AnsiColorPair` {#ansi-pairs}
185+
186+
#### `name` {#ansi-pair-name}
187+
188+
- **Description**: The name corresponding to the ANSI terminal color pair.
189+
- **Type**: `String`
190+
- **Examples**: `Black`, `Green`, `Magenta`, `Cyan`
191+
192+
#### `identifier` {#ansi-pair-identifier}
193+
194+
- **Description**: The lowercase identifier of the ANSI terminal color pair.
195+
- **Type**: `String`
196+
- **Examples**: `black`, `green`, `magenta`, `cyan`
197+
198+
#### `order` {#ansi-pair-order}
199+
200+
- **Description**: Order of the ANSI terminal color pair in the palette spec.
201+
- **Type**: `u8`
202+
- **Examples**: `0` to `7`
203+
204+
#### `normal` {#ansi-pair-normal}
205+
206+
- **Description**: The normal variant of the ANSI terminal color corresponded to by the pair's [`name`](#ansi-pair-name).
207+
- **Type**: `AnsiColor`
208+
209+
#### `bright` {#ansi-pair-bright}
210+
211+
- **Description**: The bright variant of the ANSI terminal color corresponded to by the pair's [`name`](#ansi-pair-name).
212+
- **Type**: `AnsiColor`
213+
142214
### RGB
143215

144216
#### `r` {#rgb-r}

src/models.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub struct AnsiColor {
5959
pub struct AnsiColorPair {
6060
pub name: String,
6161
pub identifier: String,
62-
pub order: u32,
62+
pub order: u8,
6363
pub normal: AnsiColor,
6464
pub bright: AnsiColor,
6565
}

0 commit comments

Comments
 (0)