From f18da4de178f4c27ca95c8a8fadfaf3cc18e13e7 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Wed, 23 Aug 2023 15:41:34 +0200 Subject: [PATCH] [mod] random answerer: add random hex color generator --- searx/answerers/random/answerer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/searx/answerers/random/answerer.py b/searx/answerers/random/answerer.py index 059dd7c87..a1306e2eb 100644 --- a/searx/answerers/random/answerer.py +++ b/searx/answerers/random/answerer.py @@ -38,12 +38,18 @@ def random_uuid(): return str(uuid.uuid4()) +def random_color(): + color = "%06x" % random.randint(0, 0xFFFFFF) + return f"#{color.upper()}" + + random_types = { 'string': random_string, 'int': random_int, 'float': random_float, 'sha256': random_sha256, 'uuid': random_uuid, + 'color': random_color, }