Add theme switchers: Admin UI (A/B/C) + Display (5 themes)
Admin UI: Dark Minimal / Retro Terminal / Warm Editorial via header buttons Display: Classic White / Dark / Sepia / Nord / Terminal via Settings tab Both switchers persist via localStorage / config.json
This commit is contained in:
@@ -337,6 +337,58 @@ def api_layout_pack():
|
||||
return jsonify({"ok": True, "items": cfg["layout"]["items"]})
|
||||
|
||||
|
||||
DISPLAY_THEMES = {
|
||||
"default": {
|
||||
"label": "Classic White",
|
||||
"bg": "#ffffff", "fg": "#000000",
|
||||
"accent": "#ff8800",
|
||||
},
|
||||
"dark": {
|
||||
"label": "Dark Mode",
|
||||
"bg": "#111111", "fg": "#f0f0f0",
|
||||
"accent": "#6d8eff",
|
||||
},
|
||||
"sepia": {
|
||||
"label": "Sepia",
|
||||
"bg": "#f4ecd8", "fg": "#5b4636",
|
||||
"accent": "#c0392b",
|
||||
},
|
||||
"nord": {
|
||||
"label": "Nord",
|
||||
"bg": "#eceff4", "fg": "#2e3440",
|
||||
"accent": "#88c0d0",
|
||||
},
|
||||
"terminal": {
|
||||
"label": "Terminal (Green)",
|
||||
"bg": "#0d0d00", "fg": "#e8c840",
|
||||
"accent": "#ffcc00",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@app.route("/api/display_theme", methods=["GET", "POST"])
|
||||
def api_display_theme():
|
||||
"""Theme für das Display. GET = aktuelles Theme, POST = setzen."""
|
||||
a = require_auth()
|
||||
if a: return a
|
||||
cfg = dashboard_mod.load_config()
|
||||
if request.method == "GET":
|
||||
theme_key = cfg.get("display_theme", "default")
|
||||
theme = DISPLAY_THEMES.get(theme_key, DISPLAY_THEMES["default"])
|
||||
return jsonify({
|
||||
"current": theme_key,
|
||||
"themes": {k: v["label"] for k, v in DISPLAY_THEMES.items()},
|
||||
"theme": theme,
|
||||
})
|
||||
data = request.get_json(silent=True) or {}
|
||||
theme_key = data.get("theme", "default")
|
||||
if theme_key not in DISPLAY_THEMES:
|
||||
return jsonify({"ok": False, "error": "unknown theme"}), 400
|
||||
cfg["display_theme"] = theme_key
|
||||
dashboard_mod.save_config(cfg)
|
||||
return jsonify({"ok": True, "current": theme_key, "theme": DISPLAY_THEMES[theme_key]})
|
||||
|
||||
|
||||
@app.route("/api/plugin_config/<plugin_name>", methods=["GET", "POST"])
|
||||
def api_plugin_config(plugin_name):
|
||||
"""Plugin-spezifische Config (separat vom Layout)."""
|
||||
|
||||
Reference in New Issue
Block a user