From d9d11e3fc19e8e80fe55de1d528479f44f72031d Mon Sep 17 00:00:00 2001 From: eiiko6 Date: Thu, 4 Jun 2026 18:16:13 +0200 Subject: [PATCH] added custom_css in config --- config.toml | 23 +++++++++++++++++++++++ src/handlers.rs | 3 +++ templates/_layout.html | 1 + 3 files changed, 27 insertions(+) diff --git a/config.toml b/config.toml index c0a371d..1aede48 100644 --- a/config.toml +++ b/config.toml @@ -13,6 +13,29 @@ success_message = "Success sending submission" # Text displayed in a popup shown after submitting, in case of an error error_message = "Error while sending submission" +custom_css = """ +:root { + --bg-body: #0f172a; + --bg-card: #1e293b; + --bg-input: #0f172a; + + --text-main: #f8fafc; + --text-muted: #94a3b8; + --text-inv: #ffffff; + + --primary: #6366f1; + --primary-hover: #818cf8; + --primary-glow: rgba(99, 102, 241, 0.25); + + --border-base: #334155; + --border-focus: #6366f1; + + --radius-lg: 16px; + --radius-md: 10px; + --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2); +} +""" + # Standard single-line input [[fields]] name = "username" diff --git a/src/handlers.rs b/src/handlers.rs index afec802..0efce79 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -52,6 +52,7 @@ pub struct AppConfig { pub success_message: String, pub error_message: String, pub fields: Vec, + pub custom_css: Option, } #[derive(Clone)] @@ -71,6 +72,7 @@ pub async fn render_form(State(state): State) -> impl IntoResponse { error_message: &'a str, fields: &'a [FieldDef], lang: &'a str, + custom_css: &'a str, } let tmpl = FormTemplate { @@ -80,6 +82,7 @@ pub async fn render_form(State(state): State) -> impl IntoResponse { error_message: &state.cfg.error_message, fields: &state.cfg.fields, lang: "en", + custom_css: state.cfg.custom_css.as_deref().unwrap_or(""), }; match tmpl.render() { Ok(html) => Html(html).into_response(), diff --git a/templates/_layout.html b/templates/_layout.html index de7d4f2..f982201 100644 --- a/templates/_layout.html +++ b/templates/_layout.html @@ -11,6 +11,7 @@