From 8fbbe23f5a4179e51c4ee945069f66c4719857bf Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Thu, 15 Jul 2021 11:55:37 +0200 Subject: [PATCH 1/3] update license --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index d449d3e..6bc5655 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) +Copyright (c) 2020 Denis Lehmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From a6bdb723002002cae649b73635356b4229f911f1 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Thu, 15 Jul 2021 11:56:32 +0200 Subject: [PATCH 2/3] update README --- README.org | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index b91324d..e24a44c 100644 --- a/README.org +++ b/README.org @@ -91,39 +91,39 @@ #+caption: Huepaper 1 [[./images/huepaper_1.png]] - =huepaper.py -p= + =huepaper -p= -------------- #+caption: Huepaper 1 [[./images/huepaper_2.png]] - =huepaper.py -p -c lightgreen= + =huepaper -p -c lightgreen= -------------- #+caption: Huepaper 3 [[./images/huepaper_3.png]] - =huepaper.py -p -c "#ff7f50" -lb 0.05= + =huepaper -p -c "#ff7f50" -lb 0.05= -------------- #+caption: Huepaper 4 [[./images/huepaper_4.png]] - =huepaper.py -p -hue 1.0 -lmin 0.3 -lmax 0.6 -smin 0.8 -smax 1.0= + =huepaper -p -hue 1.0 -lmin 0.3 -lmax 0.6 -smin 0.8 -smax 1.0= -------------- #+caption: Huepaper 5 [[./images/huepaper_5.png]] - =huepaper.py -p -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -P 64x36= + =huepaper -p -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -P 64x36= -------------- #+caption: Huepaper 6 [[./images/huepaper_6.png]] - =huepaper.py -p -l -lb -ld -e nixos.png= + =huepaper -p -l -lb -ld -e nixos.png= From 0a31e85a543b4c53e48e23112d5fc2da6bc58199 Mon Sep 17 00:00:00 2001 From: Denis Lehmann Date: Thu, 15 Jul 2021 12:14:22 +0200 Subject: [PATCH 3/3] change default behavior --- README.org | 31 ++++++++++++++++++------------- huepaper.py | 16 +++++++++------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/README.org b/README.org index e24a44c..ef6566f 100644 --- a/README.org +++ b/README.org @@ -15,9 +15,15 @@ If you have a recent version of the [[https://nixos.org/][Nix package manager]] installed and flakes are enabled, run huepaper like this: #+begin_example sh - nix run github:Deleh/huepaper -- --help + nix run github:Deleh/huepaper #+end_example + Parameters can be passed by appending a double-dash: + + #+begin_example sh + nix run github:Deleh/huepaper -- -hue 0.5 --color lightblue + #+end_example + Global installation can be done by including this flake in your flaked NixOS configuration as always :) *** Legacy @@ -26,7 +32,7 @@ #+begin_example sh pip install -r requirements.txt - ./huepaper.py --help + ./huepaper.py #+end_example To install it in your Python environment run: @@ -38,8 +44,7 @@ ** Usage #+begin_example text - usage: huepaper [-h] [-s SIZE] [-c COLOR] [-p] [-o OUTPUT] [-l [LINES]] [-lb [LINES_BRIGHT]] [-ld [LINES_DARK]] [-P [PIXELATE]] [-e EMBLEM] [-hue HUE] [-smin SMIN] - [-smax SMAX] [-lmin LMIN] [-lmax LMAX] + usage: huepaper [-h] [-s SIZE] [-c COLOR] [-np] [-o OUTPUT] [-l [LINES]] [-lb [LINES_BRIGHT]] [-ld [LINES_DARK]] [-P [PIXELATE]] [-e EMBLEM] [-hue HUE] [-smin SMIN] [-smax SMAX] [-lmin LMIN] [-lmax LMAX] Create wallpapers based on color hues. @@ -47,10 +52,10 @@ -h, --help show this help message and exit -s SIZE, --size SIZE size of huepaper in the form WIDTHxHEIGHT (default: 1920x1080) -c COLOR, --color COLOR - color, the huepaper is generated from (uses a random color if not given) - -p, --preview preview huepaper + base color from which the huepaper is generated (default: random color) + -np, --no-preview don't preview the huepaper -o OUTPUT, --output OUTPUT - file where to save the huepaper to (default: None) + filepath where the huepaper will be saved -l [LINES], --lines [LINES] include one to three random lines in base color with given opacity in range [0, 1] (default: 0.3) -lb [LINES_BRIGHT], --lines_bright [LINES_BRIGHT] @@ -91,39 +96,39 @@ #+caption: Huepaper 1 [[./images/huepaper_1.png]] - =huepaper -p= + =huepaper= -------------- #+caption: Huepaper 1 [[./images/huepaper_2.png]] - =huepaper -p -c lightgreen= + =huepaper -c lightgreen= -------------- #+caption: Huepaper 3 [[./images/huepaper_3.png]] - =huepaper -p -c "#ff7f50" -lb 0.05= + =huepaper -c "#ff7f50" -lb 0.05= -------------- #+caption: Huepaper 4 [[./images/huepaper_4.png]] - =huepaper -p -hue 1.0 -lmin 0.3 -lmax 0.6 -smin 0.8 -smax 1.0= + =huepaper -hue 1.0 -lmin 0.3 -lmax 0.6 -smin 0.8 -smax 1.0= -------------- #+caption: Huepaper 5 [[./images/huepaper_5.png]] - =huepaper -p -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -P 64x36= + =huepaper -hue 0.3 -lmin 0.5 -lmax 0.5 -l 0.5 -P 64x36= -------------- #+caption: Huepaper 6 [[./images/huepaper_6.png]] - =huepaper -p -l -lb -ld -e nixos.png= + =huepaper -l -lb -ld -e nixos.png= diff --git a/huepaper.py b/huepaper.py index 14c0383..2118251 100755 --- a/huepaper.py +++ b/huepaper.py @@ -42,11 +42,13 @@ if __name__ == "__main__": parser.add_argument( "-c", "--color", - help="color, the huepaper is generated from (uses a random color if not given)", + help="base color from which the huepaper is generated (default: random color)", ) - parser.add_argument("-p", "--preview", action="store_true", help="preview huepaper") parser.add_argument( - "-o", "--output", help="file where to save the huepaper to (default: None)" + "-np", "--no-preview", action="store_true", help="don't preview the huepaper" + ) + parser.add_argument( + "-o", "--output", help="filepath where the huepaper will be saved" ) parser.add_argument( "-l", @@ -117,7 +119,7 @@ if __name__ == "__main__": args = parser.parse_args() size = args.size color = args.color - preview = args.preview + no_preview = args.no_preview output = args.output lines = args.lines lines_bright = args.lines_bright @@ -139,8 +141,8 @@ if __name__ == "__main__": parser.error("The size must be given in form: 1920x1080") # Check preconditions - if not preview and not output: - parser.error("You must either set -p (--preview) or -o (--output)") + if no_preview and not output: + parser.error("You must either omit -np (--no-preview) or set -o (--output)") if pixelate: try: values = pixelate.split("x") @@ -171,7 +173,7 @@ if __name__ == "__main__": image.mode = "RGB" - if preview: + if not no_preview: image.show() if not output: save = input("Do you want to save the image? [y/N] ")