diff --git a/api/advent22_api/routers/days.py b/api/advent22_api/routers/days.py index fa97652..6994e16 100644 --- a/api/advent22_api/routers/days.py +++ b/api/advent22_api/routers/days.py @@ -138,6 +138,7 @@ async def get_average_color( response_class=StreamingResponse, ) async def get_picture_for_day( + index: int, letter: str = Depends(get_letter), img: Image.Image = Depends(load_picture_standard), ) -> StreamingResponse: @@ -149,7 +150,8 @@ async def get_picture_for_day( font = ImageFont.truetype("Lena.ttf", 50) # Position des Buchstaben bestimmen - xy = (100, 150) + rnd = random.Random(f"{loesungswort}{index}") + xy = tuple(rnd.choices(range(30, 370), k=2)) # betroffenen Bildbereich bestimmen text_box = await get_text_box( @@ -168,6 +170,7 @@ async def get_picture_for_day( # etwas heller/dunkler machen tc_h, tc_s, tc_v = colorsys.rgb_to_hsv(*text_color) + tc_v = int((tc_v - 127) * 0.97) + 127 if tc_v < 127: tc_v += 3