Update preview_images.py

This commit is contained in:
Joachim 2021-05-25 23:16:33 +02:00
parent e305c5d73d
commit 5b03934ec3

View file

@ -195,7 +195,11 @@ def generate_preview_image(book_id, rating=None):
# Lighten color # Lighten color
image_bg_color_rgb = [x / 255.0 for x in ImageColor.getrgb(image_bg_color)] image_bg_color_rgb = [x / 255.0 for x in ImageColor.getrgb(image_bg_color)]
image_bg_color_hls = colorsys.rgb_to_hls(*image_bg_color_rgb) image_bg_color_hls = colorsys.rgb_to_hls(*image_bg_color_rgb)
image_bg_color_hls = (image_bg_color_hls[0], 0.9, image_bg_color_hls[2]) image_bg_color_hls = (
image_bg_color_hls[0],
max(0.9, image_bg_color_hls[1]),
image_bg_color_hls[2],
)
image_bg_color = tuple( image_bg_color = tuple(
[math.ceil(x * 255) for x in colorsys.hls_to_rgb(*image_bg_color_hls)] [math.ceil(x * 255) for x in colorsys.hls_to_rgb(*image_bg_color_hls)]
) )