From 537333bf5816305418aa14347aee3cd05ce57398 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 18:28:21 +0000 Subject: [PATCH] Update code in endpoints/colour.get.py --- endpoints/colour.get.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/endpoints/colour.get.py b/endpoints/colour.get.py index e69de29..faa0808 100644 --- a/endpoints/colour.get.py +++ b/endpoints/colour.get.py @@ -0,0 +1,11 @@ +from fastapi import APIRouter, status +from typing import Dict +import random + +router = APIRouter() + +@router.get("/colour", status_code=status.HTTP_200_OK, response_model=Dict[str, str]) +async def get_random_color(): + """Get a random color in hexadecimal format""" + color = "#{:06x}".format(random.randint(0, 0xFFFFFF)) + return {"color": color} \ No newline at end of file