You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix and extend color documentation
* Drop ambiguous hash label - works just fine with only the symbol `#`
* Clarify when it is commented out vs may be (hex) value
* Drop text table of contents; the website has it's own sidebar table of contents / headline jump list
* Fix headline levels - the general color declaration docs were under Table Borders, and hex and full hex were not on the same level
* Introduce/Rename main section 'Color Configuration'
* Show command to print the current configuration
* Add closure declaration format documentation
* Drop separators following headlines; other headlines do not have this, they make no logical sense, and they lead to double-separator-lines being rendered on the website
Resolvesnushell#1503
* Improve limited closure execution note
* Add missing bool closure example
Was intended and result is described below.
* Improve closure string return description
* Be more specific about color description
Copy file name to clipboardExpand all lines: book/coloring_and_theming.md
+39-19Lines changed: 39 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,6 @@
1
1
# Coloring and Theming in Nu
2
2
3
-
Many parts of Nushell's interface can have their color customized. All of these can be set in the `config.nu` configuration file. If you see the hash/hashtag/pound mark `#` in the config file it means the text after it is commented out.
4
-
5
-
1. table borders
6
-
2. primitive values
7
-
3. shapes (this is the command line syntax)
8
-
4. prompt
9
-
5. LS_COLORS
3
+
Many parts of Nushell's interface can have their color customized. All of these can be set in the `config.nu` configuration file. If you see the `#` outside of a text value in the config file it means the text after it is commented out.
10
4
11
5
## Table Borders
12
6
@@ -34,21 +28,27 @@ Here are the current options for `$env.config.table.mode`:
34
28
-`none`
35
29
-`other`
36
30
37
-
### Color Symbologies
31
+
## Color Configuration
32
+
33
+
The color configuration is defined in `$env.config.color_config`. The current configuration can be printed with:
34
+
35
+
```nu
36
+
$env.config.color_config | sort
37
+
```
38
38
39
-
---
39
+
The color and style-attributes can be declared in multiple alternative formats.
40
40
41
41
-`r` - normal color red's abbreviation
42
42
-`rb` - normal color red's abbreviation with bold attribute
43
43
-`red` - normal color red
44
44
-`red_bold` - normal color red with bold attribute
45
45
-`"#ff0000"` - "#hex" format foreground color red (quotes are required)
46
46
-`{ fg: "#ff0000" bg: "#0000ff" attr: b }` - "full #hex" format foreground red in "#hex" format with a background of blue in "#hex" format with an attribute of bold abbreviated.
47
+
-`{|x| 'yellow' }` - closure returning a string with one of the color representations listed above
48
+
-`{|x| { fg: "#ff0000" bg: "#0000ff" attr: b } }` - closure returning a valid record
47
49
48
50
### Attributes
49
51
50
-
---
51
-
52
52
| code | meaning |
53
53
| ---- | ------------------- |
54
54
| l | blink |
@@ -197,17 +197,13 @@ Here are the current options for `$env.config.table.mode`:
197
197
198
198
### `"#hex"` Format
199
199
200
-
---
201
-
202
200
The "#hex" format is one way you typically see colors represented. It's simply the `#` character followed by 6 characters. The first two are for `red`, the second two are for `green`, and the third two are for `blue`. It's important that this string be surrounded in quotes, otherwise Nushell thinks it's a commented out string.
203
201
204
202
Example: The primary `red` color is `"#ff0000"` or `"#FF0000"`. Upper and lower case in letters shouldn't make a difference.
205
203
206
204
This `"#hex"` format allows us to specify 24-bit truecolor tones to different parts of Nushell.
207
205
208
-
## Full `"#hex"` Format
209
-
210
-
---
206
+
### Full `"#hex"` Format
211
207
212
208
The `full "#hex"` format is a take on the `"#hex"` format but allows one to specify the foreground, background, and attributes in one line.
Note: Closures are only executed for table output. They do not work in other contexts like for `shape_` configurations, when printing a value directly, or as a value in a list.
0 commit comments