-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add themes dracula, catppuccin, base16 (#19)
* feat: add themes dracula, catppuccin, base16 * fix: theme - lint errors * fix: add example for custom theme * fix: fix example for doctest * feat: add example recordings for themes
- Loading branch information
Showing
14 changed files
with
424 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,3 +147,49 @@ fn main() { | |
println!("Done!"); | ||
} | ||
``` | ||
|
||
## Themes | ||
|
||
Supply your own custom theme or choose from one of the predefined themes: | ||
|
||
Derive a custom theme from the default theme. | ||
|
||
```rust | ||
let theme = Theme { | ||
selected_prefix: String::from(" •"), | ||
selected_prefix_fg: Theme::color_rgb(2, 191, 135), | ||
unselected_prefix: String::from(" "), | ||
..Theme::default() | ||
}; | ||
|
||
Input::new("What's your e-mail?") | ||
.description("Please enter your e-mail address.") | ||
.placeholder("[email protected]") | ||
.theme(theme.clone()) | ||
.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) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use std::env::args; | ||
|
||
use demand::{Confirm, DemandOption, Input, MultiSelect, Theme}; | ||
|
||
fn main() { | ||
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.") | ||
.placeholder("[email protected]") | ||
.theme(theme.clone()); | ||
i.run().expect("error running input"); | ||
|
||
let ms = MultiSelect::new("Interests") | ||
.description("Select your interests") | ||
.min(1) | ||
.max(4) | ||
.filterable(true) | ||
.option(DemandOption::new("Art")) | ||
.option(DemandOption::new("Books")) | ||
.option(DemandOption::new("Food")) | ||
.option(DemandOption::new("Music")) | ||
.option(DemandOption::new("Technology")) | ||
.option(DemandOption::new("Travel")) | ||
.option(DemandOption::new("Sports")) | ||
.theme(theme.clone()); | ||
ms.run().expect("error running multi select"); | ||
|
||
let c = Confirm::new("Confirm privacy policy") | ||
.description("Do you accept the privacy policy?") | ||
.affirmative("Yes") | ||
.negative("No") | ||
.theme(theme.clone()); | ||
c.run().expect("error running confirm"); | ||
} |
Oops, something went wrong.