summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2023-08-23 15:41:34 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-08-27 18:59:54 +0200
commit5a5cfc19305b294bbcd45a54e937fd0252d80253 (patch)
treecaa6c2d6d99c8c99d83a1c4f8f3d75df9ca4625c /searx
parentb0d2cd5ca9d2ca167551f0a84cd7121453ee51b5 (diff)
downloadsearxng-5a5cfc19305b294bbcd45a54e937fd0252d80253.tar.gz
searxng-5a5cfc19305b294bbcd45a54e937fd0252d80253.zip
[mod] random answerer: add random hex color generator
Diffstat (limited to 'searx')
-rw-r--r--searx/answerers/random/answerer.py6
1 files changed, 6 insertions, 0 deletions
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,
}