change default behavior

This commit is contained in:
Denis Lehmann 2021-07-15 12:14:22 +02:00
parent a6bdb72300
commit 0a31e85a54
2 changed files with 27 additions and 20 deletions

View File

@ -15,7 +15,13 @@
If you have a recent version of the [[https://nixos.org/][Nix package manager]] installed and flakes are enabled, run huepaper like this: 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 #+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 #+end_example
Global installation can be done by including this flake in your flaked NixOS configuration as always :) Global installation can be done by including this flake in your flaked NixOS configuration as always :)
@ -26,7 +32,7 @@
#+begin_example sh #+begin_example sh
pip install -r requirements.txt pip install -r requirements.txt
./huepaper.py --help ./huepaper.py
#+end_example #+end_example
To install it in your Python environment run: To install it in your Python environment run:
@ -38,8 +44,7 @@
** Usage ** Usage
#+begin_example text #+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] 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]
[-smax SMAX] [-lmin LMIN] [-lmax LMAX]
Create wallpapers based on color hues. Create wallpapers based on color hues.
@ -47,10 +52,10 @@
-h, --help show this help message and exit -h, --help show this help message and exit
-s SIZE, --size SIZE size of huepaper in the form WIDTHxHEIGHT (default: 1920x1080) -s SIZE, --size SIZE size of huepaper in the form WIDTHxHEIGHT (default: 1920x1080)
-c COLOR, --color COLOR -c COLOR, --color COLOR
color, the huepaper is generated from (uses a random color if not given) base color from which the huepaper is generated (default: random color)
-p, --preview preview huepaper -np, --no-preview don't preview the huepaper
-o OUTPUT, --output OUTPUT -o OUTPUT, --output OUTPUT
file where to save the huepaper to (default: None) filepath where the huepaper will be saved
-l [LINES], --lines [LINES] -l [LINES], --lines [LINES]
include one to three random lines in base color with given opacity in range [0, 1] (default: 0.3) 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] -lb [LINES_BRIGHT], --lines_bright [LINES_BRIGHT]
@ -91,39 +96,39 @@
#+caption: Huepaper 1 #+caption: Huepaper 1
[[./images/huepaper_1.png]] [[./images/huepaper_1.png]]
=huepaper -p= =huepaper=
-------------- --------------
#+caption: Huepaper 1 #+caption: Huepaper 1
[[./images/huepaper_2.png]] [[./images/huepaper_2.png]]
=huepaper -p -c lightgreen= =huepaper -c lightgreen=
-------------- --------------
#+caption: Huepaper 3 #+caption: Huepaper 3
[[./images/huepaper_3.png]] [[./images/huepaper_3.png]]
=huepaper -p -c "#ff7f50" -lb 0.05= =huepaper -c "#ff7f50" -lb 0.05=
-------------- --------------
#+caption: Huepaper 4 #+caption: Huepaper 4
[[./images/huepaper_4.png]] [[./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 #+caption: Huepaper 5
[[./images/huepaper_5.png]] [[./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 #+caption: Huepaper 6
[[./images/huepaper_6.png]] [[./images/huepaper_6.png]]
=huepaper -p -l -lb -ld -e nixos.png= =huepaper -l -lb -ld -e nixos.png=

View File

@ -42,11 +42,13 @@ if __name__ == "__main__":
parser.add_argument( parser.add_argument(
"-c", "-c",
"--color", "--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( 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( parser.add_argument(
"-l", "-l",
@ -117,7 +119,7 @@ if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
size = args.size size = args.size
color = args.color color = args.color
preview = args.preview no_preview = args.no_preview
output = args.output output = args.output
lines = args.lines lines = args.lines
lines_bright = args.lines_bright lines_bright = args.lines_bright
@ -139,8 +141,8 @@ if __name__ == "__main__":
parser.error("The size must be given in form: 1920x1080") parser.error("The size must be given in form: 1920x1080")
# Check preconditions # Check preconditions
if not preview and not output: if no_preview and not output:
parser.error("You must either set -p (--preview) or -o (--output)") parser.error("You must either omit -np (--no-preview) or set -o (--output)")
if pixelate: if pixelate:
try: try:
values = pixelate.split("x") values = pixelate.split("x")
@ -171,7 +173,7 @@ if __name__ == "__main__":
image.mode = "RGB" image.mode = "RGB"
if preview: if not no_preview:
image.show() image.show()
if not output: if not output:
save = input("Do you want to save the image? [y/N] ") save = input("Do you want to save the image? [y/N] ")