Skip to content

Commit

Permalink
feat: add example recordings for themes
Browse files Browse the repository at this point in the history
  • Loading branch information
roele committed Jan 22, 2024
1 parent fc7f25d commit 974f49c
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 14 deletions.
14 changes: 12 additions & 2 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tasks.assets]
description = "Create assets with vhs"
[tasks."recordings input"]
description = "Create recordings with vhs"
run = """
#!/usr/bin/env bash
# Create VHS recordings of all tape files in the assets directory
Expand All @@ -8,6 +8,16 @@ for i in $(ls -1 assets/*.tape); do
done
"""

[tasks."recordings themes"]
description = "Create theme recordings with vhs"
run = """
#!/usr/bin/env bash
# Create VHS recordings of all tape files in the themes directory
for i in $(ls -1 assets/themes/*.tape); do
vhs $i
done
"""

[tasks.tests]
description = "Run tests"
run = [
Expand Down
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ fn main() {

Supply your own custom theme or choose from one of the predefined themes:

* Charm
* Dracula
* Catppuccin
* Base 16
* Default

Derive a custom theme from the default theme.

```rust
Expand All @@ -152,3 +146,27 @@ Input::new("What's your e-mail?")
.run()
.expect("error running input")?;
```

### Base 16

![base16](./assets/themes/base16.gif)

### Charm

Default if colors are enabled in the console.

![charm](./assets/themes/charm.gif)

### Catppuccin

![catppuccin](./assets/themes/catppuccin.gif)

### Dracula

![dracula](./assets/themes/dracula.gif)

### New

Default if colors are NOT enabled in the console.

![new](./assets/themes/new.gif)
Binary file added assets/themes/base16.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions assets/themes/base16.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Output assets/themes/base16.gif

Set Shell "fish"
Set Padding 10
Set FontSize 16
Set Width 800
Set Height 300
Set TypingSpeed 100ms

Hide
Type "cargo build --example themes && clear" Enter
Sleep 2s
Show

Type "target/debug/examples/themes base16" Enter
Sleep 2s
Type "[email protected]" Sleep 1s Enter

Space Sleep 1s
Down Down Space Sleep 1s
Enter

Sleep 1s
Enter

Sleep 2s
Binary file added assets/themes/catppuccin.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions assets/themes/catppuccin.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Output assets/themes/catppuccin.gif

Set Shell "fish"
Set Padding 10
Set FontSize 16
Set Width 800
Set Height 300
Set TypingSpeed 100ms

Hide
Type "cargo build --example themes && clear" Enter
Sleep 2s
Show

Type "target/debug/examples/themes catppuccin" Enter
Sleep 2s
Type "[email protected]" Sleep 1s Enter

Space Sleep 1s
Down Down Space Sleep 1s
Enter

Sleep 1s
Enter

Sleep 2s
Binary file added assets/themes/charm.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions assets/themes/charm.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Output assets/themes/charm.gif

Set Shell "fish"
Set Padding 10
Set FontSize 16
Set Width 800
Set Height 300
Set TypingSpeed 100ms

Hide
Type "cargo build --example themes && clear" Enter
Sleep 2s
Show

Type "target/debug/examples/themes charm" Enter
Sleep 2s
Type "[email protected]" Sleep 1s Enter

Space Sleep 1s
Down Down Space Sleep 1s
Enter

Sleep 1s
Enter

Sleep 2s
Binary file added assets/themes/dracula.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions assets/themes/dracula.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Output assets/themes/dracula.gif

Set Shell "fish"
Set Padding 10
Set FontSize 16
Set Width 800
Set Height 300
Set TypingSpeed 100ms

Hide
Type "cargo build --example themes && clear" Enter
Sleep 2s
Show

Type "target/debug/examples/themes dracula" Enter
Sleep 2s
Type "[email protected]" Sleep 1s Enter

Space Sleep 1s
Down Down Space Sleep 1s
Enter

Sleep 1s
Enter

Sleep 2s
Binary file added assets/themes/new.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions assets/themes/new.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Output assets/themes/new.gif

Set Shell "fish"
Set Padding 10
Set FontSize 16
Set Width 800
Set Height 300
Set TypingSpeed 100ms

Hide
Type "cargo build --example themes && clear" Enter
Sleep 2s
Show

Type "target/debug/examples/themes" Enter
Sleep 2s
Type "[email protected]" Sleep 1s Enter

Space Sleep 1s
Down Down Space Sleep 1s
Enter

Sleep 1s
Enter

Sleep 2s
19 changes: 13 additions & 6 deletions examples/themes.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
use std::env::args;

use demand::{Confirm, DemandOption, Input, MultiSelect, Theme};

fn main() {
let theme = Theme {
selected_prefix: String::from(" •"),
selected_prefix_fg: Theme::color_rgb(2, 191, 135),
unselected_prefix: String::from(" "),
..Theme::default()
};
let mut theme = Theme::new();
match args().nth(1) {
Some(arg) => match arg.as_str() {
"base16" => theme = Theme::base16(),
"charm" => theme = Theme::charm(),
"catppuccin" => theme = Theme::catppuccin(),
"dracula" => theme = Theme::dracula(),
_ => {}
},
None => {}
}

let i = Input::new("What's your e-mail?")
.description("Please enter your e-mail address.")
Expand Down

0 comments on commit 974f49c

Please sign in to comment.