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