From 82d512f6c389ab0577e9f88c01f572f9363ad950 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 4 Dec 2024 18:21:55 +0100
Subject: [PATCH] Make background color configurable.

---
 src/templates/_base.tmpl | 2 +-
 src/ytplom/http.py       | 1 +
 src/ytplom/misc.py       | 4 +++-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/templates/_base.tmpl b/src/templates/_base.tmpl
index d87faeb..90deafb 100644
--- a/src/templates/_base.tmpl
+++ b/src/templates/_base.tmpl
@@ -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 %}
diff --git a/src/ytplom/http.py b/src/ytplom/http.py
index b0aea64..5ead023 100644
--- a/src/ytplom/http.py
+++ b/src/ytplom/http.py
@@ -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'))
diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py
index 438a8cd..88d24c6 100644
--- a/src/ytplom/misc.py
+++ b/src/ytplom/misc.py
@@ -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):
-- 
2.30.2