home · contact · privacy
Make background color configurable.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 4 Dec 2024 17:21:55 +0000 (18:21 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 4 Dec 2024 17:21:55 +0000 (18:21 +0100)
src/templates/_base.tmpl
src/ytplom/http.py
src/ytplom/misc.py

index d87faebcc3cf98e0ca72b4de208fa7f7ebdbb136..90deafb09fd5e73f5c8e35131587f7dca9003e4c 100644 (file)
@@ -8,7 +8,7 @@
 {% endblock %}
 </script>
 <style>
-body { background-color: #aaaa00; }
+body { background-color: {{background_color}}; }
 table { width: 100%; }
 td, th { vertical-align: top; text-align: left; }
 {% block css %}
index b0aea6445f409c1bd4da8270156ab87586a347d8..5ead0233d71865ffe7a452917da422e44678392e 100644 (file)
@@ -196,6 +196,7 @@ class _TaskHandler(BaseHTTPRequestHandler):
                                 tmpl_ctx: _TemplateContext
                                 ) -> None:
         tmpl = self.server.jinja.get_template(str(tmpl_name))
+        tmpl_ctx['background_color'] = self.server.config.background_color
         tmpl_ctx['page_names'] = PAGE_NAMES
         html = tmpl.render(**tmpl_ctx)
         self._send_http(bytes(html, 'utf8'))
index 438a8cde6b922d54efc4002fc4eb1167baf0696b..88d24c640c393f757df7c305c321972b5baa81ec 100644 (file)
@@ -26,7 +26,8 @@ from ytplom.primitives import HandledException, NotFoundException
 DEFAULTS = {
     'host': '127.0.0.1',  # NB: to be found remotely, use '0.0.0.0'!
     'port': 8090,
-    'port_remote': 8090
+    'port_remote': 8090,
+    'background_color': '#ffffff'
 }
 
 # type definitions for mypy
@@ -89,6 +90,7 @@ class Config:
     port: int
     port_remote: int
     api_key: str
+    background_color: str
 
     def __init__(self):
         def set_attrs_from_dict(d):