1
1
# Examples
2
2
3
- These gifs were created using [ Charm VHS] ( https://github.com/charmbracelet/vhs ) .
3
+ These gifs were created using [ VHS] ( https://github.com/charmbracelet/vhs ) . Each example has a
4
+ corresponding ` .tape ` file that holds instructions for how to generate the images. Note that the
5
+ images themselves are stored in a separate git branch to avoid bloating the main repository.
4
6
5
- VHS has a problem rendering some background color transitions, which shows up in several examples
6
- below. See < https://github.com/charmbracelet/vhs/issues/344 > for more info. These problems don't
7
- occur in a terminal.
7
+ ## Demo2
8
+
9
+ This is the demo example from the main README and crate page. Source: [ demo2] ( ./demo2/ ) .
10
+
11
+ ``` shell
12
+ cargo run --example=demo2 --features=crossterm
13
+ ```
14
+
15
+ ![ Demo2] [ demo2.gif ]
8
16
9
17
## Demo
10
18
@@ -102,19 +110,20 @@ cargo run --example=colors --features=crossterm
102
110
103
111
Demonstrates the available RGB
104
112
[ ` Color ` ] ( https://docs.rs/ratatui/latest/ratatui/style/enum.Color.html ) options. These can be used
105
- in any style field. Source: [ colors_rgb.rs] ( ./colors_rgb.rs ) .
113
+ in any style field. Source: [ colors_rgb.rs] ( ./colors_rgb.rs ) . Uses a half block technique to render
114
+ two square-ish pixels in the space of a single rectangular terminal cell.
106
115
107
116
``` shell
108
117
cargo run --example=colors_rgb --features=crossterm
109
118
```
110
119
111
- ![ Colors RGB] [ colors_rgb.gif ]
120
+ ![ Colors RGB] [ colors_rgb.png ]
112
121
113
122
## Custom Widget
114
123
115
124
Demonstrates how to implement the
116
- [ ` Widget ` ] ( https://docs.rs/ratatui/latest/ratatui/widgets/trait.Widget.html ) trait. Source:
117
- [ custom_widget.rs] ( ./custom_widget.rs ) .
125
+ [ ` Widget ` ] ( https://docs.rs/ratatui/latest/ratatui/widgets/trait.Widget.html ) trait. Also shows mouse
126
+ interaction. Source: [ custom_widget.rs] ( ./custom_widget.rs ) .
118
127
119
128
``` shell
120
129
cargo run --example=custom_widget --features=crossterm
@@ -127,10 +136,6 @@ cargo run --example=custom_widget --features=crossterm
127
136
Demonstrates the [ ` Gauge ` ] ( https://docs.rs/ratatui/latest/ratatui/widgets/struct.Gauge.html ) widget.
128
137
Source: [ gauge.rs] ( ./gauge.rs ) .
129
138
130
- > [ !NOTE] The backgrounds render poorly when we generate this example using VHS. This problem
131
- > doesn't generally happen during normal rendering in a terminal. See
132
- > [ vhs #344 ] ( https://github.com/charmbracelet/vhs/issues/344 ) for more details.
133
-
134
139
``` shell
135
140
cargo run --example=gauge --features=crossterm
136
141
```
@@ -139,7 +144,7 @@ cargo run --example=gauge --features=crossterm
139
144
140
145
## Inline
141
146
142
- Demonstrates the
147
+ Demonstrates how to use the
143
148
[ ` Inline ` ] ( https://docs.rs/ratatui/latest/ratatui/terminal/enum.Viewport.html#variant.Inline )
144
149
Viewport mode for ratatui apps. Source: [ inline.rs] ( ./inline.rs ) .
145
150
@@ -216,10 +221,6 @@ Demonstrates how to render a widget over the top of previously rendered widgets
216
221
cargo run --example=popup --features=crossterm
217
222
```
218
223
219
- > [ !NOTE] The background renders poorly after the popup when we generate this example using VHS.
220
- > This problem doesn't generally happen during normal rendering in a terminal. See
221
- > [ vhs #344 ] ( https://github.com/charmbracelet/vhs/issues/344 ) for more details.
222
-
223
224
![ Popup] [ popup.gif ]
224
225
225
226
## Scrollbar
@@ -238,10 +239,6 @@ cargo run --example=scrollbar --features=crossterm
238
239
Demonstrates the [ ` Sparkline ` ] ( https://docs.rs/ratatui/latest/ratatui/widgets/struct.Sparkline.html )
239
240
widget. Source: [ sparkline.rs] ( ./sparkline.rs ) .
240
241
241
- > [ !NOTE] The background renders poorly in the second sparkline when we generate this example using
242
- > VHS. This problem doesn't generally happen during normal rendering in a terminal. See
243
- > [ vhs #344 ] ( https://github.com/charmbracelet/vhs/issues/344 ) for more details.
244
-
245
242
``` shell
246
243
cargo run --example=sparkline --features=crossterm
247
244
```
@@ -292,15 +289,17 @@ To update these examples in bulk:
292
289
examples/generate.bash
293
290
```
294
291
-->
292
+
295
293
[ barchart.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/barchart.gif?raw=true
296
294
[ block.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/block.gif?raw=true
297
295
[ calendar.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/calendar.gif?raw=true
298
296
[ canvas.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/canvas.gif?raw=true
299
297
[ chart.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/chart.gif?raw=true
300
298
[ colors.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/colors.gif?raw=true
301
- [ colors_rgb.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/colors_rgb.gif ?raw=true
299
+ [ colors_rgb.png ] : https://github.com/ratatui-org/ratatui/blob/images/examples/colors_rgb.png ?raw=true
302
300
[ custom_widget.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/custom_widget.gif?raw=true
303
301
[ demo.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/demo.gif?raw=true
302
+ [ demo2.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/demo2.gif?raw=true
304
303
[ gauge.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/gauge.gif?raw=true
305
304
[ hello_world.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/hello_world.gif?raw=true
306
305
[ inline.gif ] : https://github.com/ratatui-org/ratatui/blob/images/examples/inline.gif?raw=true
0 commit comments