Skip to content

Commit f2ee796

Browse files
committed
feat(decor:shadow): add a background cli flag -b or --bg
- this flag accepts `white`, `black` and `transparent` - it defaults to `white` - so that the target color where the gif needs to be embedded can be changed - extend the CHANGELOG.md
1 parent bac120e commit f2ee796

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
## [0.3.0] - XXXX
1010
### Added
1111
- command line parameter `-d` or `--decor` that allows to turn on and off effects [feat(decor:shadow)]
12+
- command line parameter `-b` or `--bg` that allows to change the target background color to white, black or transparent
1213
- command line parameter `-v` or `--verbose` that shows insights on the window name and window id for the curious
1314
- turn on the new shadow decor effect by default
1415
![demo](./docs/demo-shadow.gif)

src/cli.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ pub fn launch<'a>() -> ArgMatches<'a> {
2424
.long("decor")
2525
.help("Decorates the animation with certain, mostly border effects")
2626
)
27+
.arg(
28+
Arg::with_name("bg")
29+
.takes_value(true)
30+
.possible_values(&["white", "black", "transparent"])
31+
.default_value("white")
32+
.required(false)
33+
.short("b")
34+
.long("bg")
35+
.help("Background color when decors are used")
36+
)
2737
.arg(
2838
Arg::with_name("natural-mode")
2939
.value_name("natural")

src/decor_effect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tempfile::TempDir;
1515
/// -layers merge \
1616
/// t-rec-frame-000000251.tga
1717
/// ```
18-
pub fn apply_shadow_effect(time_codes: &[u128], tempdir: &TempDir) -> Result<()> {
18+
pub fn apply_shadow_effect(time_codes: &[u128], tempdir: &TempDir, bg_color: String) -> Result<()> {
1919
apply_effect(
2020
time_codes,
2121
tempdir,
@@ -25,7 +25,7 @@ pub fn apply_shadow_effect(time_codes: &[u128], tempdir: &TempDir) -> Result<()>
2525
.arg("(")
2626
.args(&["+clone", "-background", "black", "-shadow", "100x20+0+0"])
2727
.arg(")")
28-
.args(&["+swap", "-background", "white"])
28+
.args(&["+swap", "-background", bg_color.as_str()])
2929
.args(&["-layers", "merge"])
3030
.arg(file.to_str().unwrap())
3131
.spawn()

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ fn main() -> Result<()> {
119119
apply_shadow_effect(
120120
&time_codes.lock().unwrap(),
121121
tempdir.lock().unwrap().borrow(),
122+
args.value_of("bg").unwrap().to_string(),
122123
)?
123124
}
124125

0 commit comments

Comments
 (0)