11 lines
351 B
Python
11 lines
351 B
Python
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} |