From 6619a86d6f7de76c981f02e45359b1317e4e0c53 Mon Sep 17 00:00:00 2001
From: Blomblo <63555404+mrblomblo@users.noreply.github.com>
Date: Sat, 20 Sep 2025 17:08:15 +0200
Subject: [PATCH 4/8] Fix theme previews not being applied
---
src/Pages/Shared/_Layout.cshtml | 6 +++++-
src/Pages/ThemePreview.cshtml | 7 -------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/Pages/Shared/_Layout.cshtml b/src/Pages/Shared/_Layout.cshtml
index 54bd5ebfc..5d165d2e2 100644
--- a/src/Pages/Shared/_Layout.cshtml
+++ b/src/Pages/Shared/_Layout.cshtml
@@ -6,8 +6,12 @@
@ViewData["Title"] - SwarmUI - @Program.ServerSettings.UserAuthorization.InstanceTitle
@{
string themeId = "modern_dark";
+ string pageThemeOverride = ViewContext.HttpContext.Request.Query["theme"].ToString();
+ if (!string.IsNullOrEmpty(pageThemeOverride) && Program.Web.RegisteredThemes.ContainsKey(pageThemeOverride)) {
+ themeId = pageThemeOverride;
+ }
// TODO: Identify user by auth header and use their settings to determine theme
- if (ViewContext.HttpContext.Request.Cookies.TryGetValue("sui_theme_id", out string themeCookie) && Program.Web.RegisteredThemes.ContainsKey(themeCookie)) {
+ else if (ViewContext.HttpContext.Request.Cookies.TryGetValue("sui_theme_id", out string themeCookie) && Program.Web.RegisteredThemes.ContainsKey(themeCookie)) {
themeId = themeCookie;
}
WebServer.ThemeData theme = Program.Web.RegisteredThemes[themeId];
diff --git a/src/Pages/ThemePreview.cshtml b/src/Pages/ThemePreview.cshtml
index 39a4311dd..d12672140 100644
--- a/src/Pages/ThemePreview.cshtml
+++ b/src/Pages/ThemePreview.cshtml
@@ -2,13 +2,6 @@
@section Header {
- @{
- var themeId = Request.Query["theme"].ToString();
- if (!string.IsNullOrEmpty(themeId))
- {
-
- }
- }
}
From e803b234de2cb7cc3399d59935b5c24f64379c81 Mon Sep 17 00:00:00 2001
From: Blomblo <63555404+mrblomblo@users.noreply.github.com>
Date: Thu, 25 Sep 2025 19:02:46 +0200
Subject: [PATCH 5/8] Use ViewData instead of GET for overriding theme in
_Layout
---
src/Pages/Shared/_Layout.cshtml | 7 ++++---
src/Pages/ThemePreview.cshtml | 4 ++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/Pages/Shared/_Layout.cshtml b/src/Pages/Shared/_Layout.cshtml
index 5d165d2e2..a00bcc8b4 100644
--- a/src/Pages/Shared/_Layout.cshtml
+++ b/src/Pages/Shared/_Layout.cshtml
@@ -6,9 +6,10 @@
@ViewData["Title"] - SwarmUI - @Program.ServerSettings.UserAuthorization.InstanceTitle
@{
string themeId = "modern_dark";
- string pageThemeOverride = ViewContext.HttpContext.Request.Query["theme"].ToString();
- if (!string.IsNullOrEmpty(pageThemeOverride) && Program.Web.RegisteredThemes.ContainsKey(pageThemeOverride)) {
- themeId = pageThemeOverride;
+ var themeOverride = ViewData["theme_override"]?.ToString();
+ if (!string.IsNullOrEmpty(themeOverride) && Program.Web.RegisteredThemes.ContainsKey(themeOverride))
+ {
+ themeId = themeOverride;
}
// TODO: Identify user by auth header and use their settings to determine theme
else if (ViewContext.HttpContext.Request.Cookies.TryGetValue("sui_theme_id", out string themeCookie) && Program.Web.RegisteredThemes.ContainsKey(themeCookie)) {
diff --git a/src/Pages/ThemePreview.cshtml b/src/Pages/ThemePreview.cshtml
index d12672140..a4ac84154 100644
--- a/src/Pages/ThemePreview.cshtml
+++ b/src/Pages/ThemePreview.cshtml
@@ -1,4 +1,8 @@
@page
+@{
+ var themeOverride = Request.Query["theme"].ToString();
+ ViewData["theme_override"] = themeOverride;
+}
@section Header {
From 3229b3acaed06cbc92dd02cef2feb2a932dc4b2d Mon Sep 17 00:00:00 2001
From: Blomblo <63555404+mrblomblo@users.noreply.github.com>
Date: Fri, 3 Oct 2025 23:26:03 +0200
Subject: [PATCH 6/8] Add core parameters to preview Known issue: two icons are
present in the seed buttons in modern themes
---
src/Pages/ThemePreview.cshtml | 35 ++++++++++++++++++++++++++++++--
src/wwwroot/css/themepreview.css | 7 +++++++
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/src/Pages/ThemePreview.cshtml b/src/Pages/ThemePreview.cshtml
index a4ac84154..d453d2cb6 100644
--- a/src/Pages/ThemePreview.cshtml
+++ b/src/Pages/ThemePreview.cshtml
@@ -7,9 +7,36 @@
}
+
-
-
Core Parameters will go here
+
+
+
+
@@ -22,3 +49,7 @@
+
+@section Scripts {
+
+}
diff --git a/src/wwwroot/css/themepreview.css b/src/wwwroot/css/themepreview.css
index aeb2a5e5e..d6ec87e5c 100644
--- a/src/wwwroot/css/themepreview.css
+++ b/src/wwwroot/css/themepreview.css
@@ -24,3 +24,10 @@ html, body {
font-size: 1.25rem;
margin-bottom: 0;
}
+.input-group.input-group-open {
+ display: block;
+ margin: 0 0.5rem;
+}
+.input-group.input-group-open .input-group-content {
+ margin-top: 0;
+}
From 54a5f85c7f5656f2eaf2e578d9bea072023767b2 Mon Sep 17 00:00:00 2001
From: Blomblo <63555404+mrblomblo@users.noreply.github.com>
Date: Sat, 4 Oct 2025 13:07:55 +0200
Subject: [PATCH 7/8] Fixes - Add missing semicolon in themepreview CSS -
Remove unnecessary popover creation logic - Fix label CSS in installer CSS
---
src/Pages/ThemePreview.cshtml | 4 ----
src/wwwroot/css/installer.css | 10 +++++++---
src/wwwroot/css/themepreview.css | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/Pages/ThemePreview.cshtml b/src/Pages/ThemePreview.cshtml
index d453d2cb6..1cd3a266c 100644
--- a/src/Pages/ThemePreview.cshtml
+++ b/src/Pages/ThemePreview.cshtml
@@ -25,10 +25,6 @@ function generateInputs() {
}
document.addEventListener('DOMContentLoaded', function() {
- makeGenericPopover('input_images', 'Images', 'Integer', 'How many images to generate at once.', ["1", "4"])
- makeGenericPopover('input_seed', 'Seed', 'Integer', 'Image seed.\n-1 = random.\nDifferent seeds produce different results for the same prompt.', ["1", "2", "...", "10"])
- makeGenericPopover('input_steps', 'Steps', 'Integer', 'Diffusion works by running a model repeatedly to slowly build and then refine an image.\nThis parameter is how many times to run the model.\nMore steps = better quality, but more time.\n20 is a good baseline for speed, 40 is good for maximizing quality.\nSome models, such as Turbo models, are intended for low step counts like 4 or 8.\nYou can go much higher, but it quickly becomes pointless above 70 or so.\nNote that steps is a core parameter used for defining diffusion schedules and other advanced internals,\nand merely running the model over top of an existing image is not the same as increasing the steps.\nNote that the number of steps actually ran can be influenced by other parameters such as Init Image Creativity when applied.', ["10", "15", "20", "30", "40"])
- makeGenericPopover('input_cfgscale', 'CFG Scale', 'Decimal', 'How strongly to scale prompt input.\nHigher CFG scales tend to produce more contrast, and lower CFG scales produce less contrast.\nToo-high values can cause corrupted/burnt images, too-low can cause nonsensical images.\n7 is a good baseline. Normal usages vary between 4 and 9.\nSome model types, such as Flux, Hunyuan Video, or any Turbo model, expect CFG to be set to 1.', ["5", "6", "7", "8", "9"])
generateInputs();
});
diff --git a/src/wwwroot/css/installer.css b/src/wwwroot/css/installer.css
index 6b0d25e8e..9cdf10060 100644
--- a/src/wwwroot/css/installer.css
+++ b/src/wwwroot/css/installer.css
@@ -38,6 +38,11 @@
.theme_preview .form-check:has(.form-check-input:checked) {
border: 1px solid var(--emphasis);
}
+.theme_preview label {
+ margin-top: 0.125rem;
+ margin-left: 0.5rem;
+ cursor: pointer;
+}
.form-check .form-check-input {
margin-left: 0.5rem;
margin-top: 0.5rem;
@@ -52,10 +57,9 @@
left: 0;
}
label {
- margin-top: 0.125rem;
- margin-left: 0.5rem;
- cursor: pointer;
font-size: 120%;
+ vertical-align: top;
+ margin-top: -0.3rem;
}
.final_confirm_info {
font-weight: bold;
diff --git a/src/wwwroot/css/themepreview.css b/src/wwwroot/css/themepreview.css
index d6ec87e5c..11994c380 100644
--- a/src/wwwroot/css/themepreview.css
+++ b/src/wwwroot/css/themepreview.css
@@ -1,5 +1,5 @@
html, body {
- height: 100%
+ height: 100%;
}
#alt_generate_button {
margin-left: 0 !important;
From f2e56a7446a61625910e2228a07d5d946d00e515 Mon Sep 17 00:00:00 2001
From: Blomblo <63555404+mrblomblo@users.noreply.github.com>
Date: Sat, 4 Oct 2025 23:11:24 +0200
Subject: [PATCH 8/8] Add noise image bg to core params
---
src/Pages/ThemePreview.cshtml | 2 +-
src/wwwroot/css/themepreview.css | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/Pages/ThemePreview.cshtml b/src/Pages/ThemePreview.cshtml
index 1cd3a266c..ecf972e18 100644
--- a/src/Pages/ThemePreview.cshtml
+++ b/src/Pages/ThemePreview.cshtml
@@ -29,7 +29,7 @@ document.addEventListener('DOMContentLoaded', function() {
});