Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[mod] random answerer: add random hex color generator

Bnyro5a5cfc19305b
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,
}