Merge branch 'master' of git.opaque.tech:denis/huepaper

This commit is contained in:
Denis Lehmann 2020-09-12 13:44:32 +00:00
commit 48bbe7456b
4 changed files with 62 additions and 65 deletions

View File

@ -2,9 +2,13 @@
![Logo](./images/logo.png) ![Logo](./images/logo.png)
**huepaper** creates wallpapers based on color hues. Bring a little **huepaper** creates colorful wallpapers, using the [HSL color
color in your life by randomness, because every huepaper is truly space](https://en.wikipedia.org/wiki/HSL_and_HSV). It is based on
unique. [**colour**](https://github.com/vaab/colour) and
[**pillow**](https://python-pillow.org/).
Every *huepaper* is randomly generated and therefore truly unique. Let
randomness bring a little color in your life.
You can find [examples](#examples) below. You can find [examples](#examples) below.
@ -33,18 +37,18 @@ Install the python requirements with `pip install -r requirements.txt`.
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
-W WIDTH, --width WIDTH -W WIDTH, --width WIDTH
width of wallpaper (defaul: 1920) width of huepaper (default: 1920)
-H HEIGHT, --height HEIGHT -H HEIGHT, --height HEIGHT
height of wallpaper (default: 1080) height of huepaper (default: 1080)
-c COLOR, --color COLOR -c COLOR, --color COLOR
color, the wallpaper is generated from (uses a random color, the huepaper is generated from (uses a random
color if not given) color if not given)
-p, --preview preview wallpaper -p, --preview preview huepaper
-o OUTPUT, --output OUTPUT -o OUTPUT, --output OUTPUT
file where to save the wallpaper to (default: None) file where to save the huepaper to (default: None)
-l [LINES], --lines [LINES] -l [LINES], --lines [LINES]
include one to three random lines in base color with include one to three random lines in base color with
given opacity in range [0, 1] (default: 0.1) given opacity in range [0, 1] (default: 0.3)
-lb [LINES_BRIGHT], --lines_bright [LINES_BRIGHT] -lb [LINES_BRIGHT], --lines_bright [LINES_BRIGHT]
include one to three bright random lines with given include one to three bright random lines with given
opacity in range [0, 1] (default: 0.1) opacity in range [0, 1] (default: 0.1)
@ -54,7 +58,7 @@ Install the python requirements with `pip install -r requirements.txt`.
-P PIXELATE, --pixelate PIXELATE -P PIXELATE, --pixelate PIXELATE
pixelate image (e.g. 42x42) pixelate image (e.g. 42x42)
-e EMBLEM, --emblem EMBLEM -e EMBLEM, --emblem EMBLEM
emblem to add in the center of the wallpaper emblem to add in the center of the huepaper
-hue HUE maximum hue to differ from given color in range [0, 1] -hue HUE maximum hue to differ from given color in range [0, 1]
(default: 0.1) (default: 0.1)
-smin SMIN minimum satisfaction for colors in range [0, 1] -smin SMIN minimum satisfaction for colors in range [0, 1]

View File

@ -8,6 +8,21 @@ from colour import Color
from PIL import Image, ImageDraw, ImageOps from PIL import Image, ImageDraw, ImageOps
def print_logo():
logo = '''
.lk.
cO.
cO.;:lc. ,c. .cc .,',c; .,c.;coc. ;,.,c. ':l.:lo: '',:c. '::.lo.
cO' kd .O; dO ,x...,Ox cO; lO: ;x xk OO. .kO. x;...x0' 0x. .
cO. xx .O; dO ko...... :O. Ox .,..xO kk ;0;;0...... 0d
cO. xx .O; xO dO. .. :O. .O; dk xO kk :O.'0o , 0d
.dk, .kk. okc;,ox' ckxllc. :Oc'.,l' oOl;'dO:. kO;..:l. ,xOolc; ,Ox.
:O. kk
lO, OO
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO00O0000000000000000;
''';
print(logo)
# Get base color # Get base color
def get_base_color(color_string = None): def get_base_color(color_string = None):
@ -189,16 +204,16 @@ def main():
# Initialize parser # Initialize parser
parser = argparse.ArgumentParser(description = 'Create wallpapers based on color hues.') parser = argparse.ArgumentParser(description = 'Create wallpapers based on color hues.')
parser.add_argument('-W', '--width', default = 1920, type = int, help = 'width of wallpaper (defaul: 1920)') parser.add_argument('-W', '--width', default = 1920, type = int, help = 'width of huepaper (default: 1920)')
parser.add_argument('-H', '--height', default = 1080, type = int, help = 'height of wallpaper (default: 1080)') parser.add_argument('-H', '--height', default = 1080, type = int, help = 'height of huepaper (default: 1080)')
parser.add_argument('-c', '--color', help = 'color, the wallpaper is generated from (uses a random color if not given)') parser.add_argument('-c', '--color', help = 'color, the huepaper is generated from (uses a random color if not given)')
parser.add_argument('-p', '--preview', action = 'store_true', help = 'preview wallpaper') parser.add_argument('-p', '--preview', action = 'store_true', help = 'preview huepaper')
parser.add_argument('-o', '--output', help = 'file where to save the wallpaper to (default: None)') parser.add_argument('-o', '--output', help = 'file where to save the huepaper to (default: None)')
parser.add_argument('-l', '--lines', nargs = '?', const = 0.1, type = float, help = 'include one to three random lines in base color with given opacity in range [0, 1] (default: 0.1)') parser.add_argument('-l', '--lines', nargs = '?', const = 0.3, type = float, help = 'include one to three random lines in base color with given opacity in range [0, 1] (default: 0.3)')
parser.add_argument('-lb', '--lines_bright', nargs = '?', const = 0.1, type = float, help = 'include one to three bright random lines with given opacity in range [0, 1] (default: 0.1)') parser.add_argument('-lb', '--lines_bright', nargs = '?', const = 0.1, type = float, help = 'include one to three bright random lines with given opacity in range [0, 1] (default: 0.1)')
parser.add_argument('-ld', '--lines_dark', nargs = '?', const = 0.1, type = float, help = 'include one to three dark random lines with given opacity in range [0, 1] (default: 0.1)') parser.add_argument('-ld', '--lines_dark', nargs = '?', const = 0.1, type = float, help = 'include one to three dark random lines with given opacity in range [0, 1] (default: 0.1)')
parser.add_argument('-P', '--pixelate', help = "pixelate image (e.g. 42x42)") parser.add_argument('-P', '--pixelate', help = "pixelate image (e.g. 42x42)")
parser.add_argument('-e', '--emblem', help = 'emblem to add in the center of the wallpaper') parser.add_argument('-e', '--emblem', help = 'emblem to add in the center of the huepaper')
parser.add_argument('-hue', default = 0.1, type = float, help = 'maximum hue to differ from given color in range [0, 1] (default: 0.1)') parser.add_argument('-hue', default = 0.1, type = float, help = 'maximum hue to differ from given color in range [0, 1] (default: 0.1)')
parser.add_argument('-smin', default = 0.2, type = float, help = 'minimum satisfaction for colors in range [0, 1] (default: 0.2)') parser.add_argument('-smin', default = 0.2, type = float, help = 'minimum satisfaction for colors in range [0, 1] (default: 0.2)')
parser.add_argument('-smax', default = 1.0, type = float, help = 'maximum satisfaction for colors in range [0, 1] (default: 1.0)') parser.add_argument('-smax', default = 1.0, type = float, help = 'maximum satisfaction for colors in range [0, 1] (default: 1.0)')
@ -235,6 +250,7 @@ def main():
parser.error('Pixelation value must be set in form: 42x42') parser.error('Pixelation value must be set in form: 42x42')
# Main routine # Main routine
print_logo()
base_color = get_base_color(color) base_color = get_base_color(color)
c1, c2, c3, c4 = create_colors(base_color) c1, c2, c3, c4 = create_colors(base_color)
image = create_base_image(c1, c2, c3, c4) image = create_base_image(c1, c2, c3, c4)
@ -252,6 +268,8 @@ def main():
if emblem: if emblem:
image = add_emblem(image, emblem) image = add_emblem(image, emblem)
image.mode = 'RGB'
if preview: if preview:
image.show() image.show()
if not output: if not output:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 12 KiB