Skip to content

A platform for community discussion. Free, open, simple.

UX: Illustrate theme previews in the design wizard (#45344)

Penar Musaraj2af99ad994ec
diff --git a/app/assets/stylesheets/common/components/design-wizard.scss b/app/assets/stylesheets/common/components/design-wizard.scss
index c1f45deb111..c7ed9864dab 100644
--- a/app/assets/stylesheets/common/components/design-wizard.scss
+++ b/app/assets/stylesheets/common/components/design-wizard.scss
@@ -369,10 +369,7 @@ $dw-button-default-border: #d3d3d3;
position: relative;
display: flex;
align-items: center;
-
- // matches the serialized screenshot size, so the box is reserved at the
- // right shape before the image lands and the card never reflows
- aspect-ratio: 16 / 9;
+ aspect-ratio: 8 / 5;
overflow: hidden;
background: var(--primary-very-low);
border: 1px solid var(--content-border-color);
@@ -401,7 +398,7 @@ $dw-button-default-border: #d3d3d3;
display: block;
width: 100%;
height: 100%;
- object-fit: cover;
+ object-fit: contain;
/*! rtl:ignore */
object-position: top left;
diff --git a/app/serializers/design_wizard_theme_serializer.rb b/app/serializers/design_wizard_theme_serializer.rb
index d5b047019f5..98e522da003 100644
--- a/app/serializers/design_wizard_theme_serializer.rb
+++ b/app/serializers/design_wizard_theme_serializer.rb
@@ -30,13 +30,13 @@ class DesignWizardThemeSerializer < ApplicationSerializer
end
def screenshot_light_url
- ThemeScreenshotThumbnails.url_for(object, "screenshot_light") || object.screenshot_light_url ||
- fallback_screenshot_url(:screenshot_light_url)
+ preview_url("light") || ThemeScreenshotThumbnails.url_for(object, "screenshot_light") ||
+ object.screenshot_light_url
end
def screenshot_dark_url
- ThemeScreenshotThumbnails.url_for(object, "screenshot_dark") || object.screenshot_dark_url ||
- fallback_screenshot_url(:screenshot_dark_url)
+ preview_url("dark") || ThemeScreenshotThumbnails.url_for(object, "screenshot_dark") ||
+ object.screenshot_dark_url
end
def palette_pairs
@@ -49,7 +49,12 @@ class DesignWizardThemeSerializer < ApplicationSerializer
@definition ||= DesignWizard::Themes.definition_for(object) || {}
end
- def fallback_screenshot_url(name)
- Discourse.base_path + definition[name] if definition[name]
+ def preview_url(mode)
+ name = Theme::CORE_THEMES.key(object.id)
+ if name
+ "#{Discourse.base_path}/images/design-wizard/#{name}-#{mode}.webp"
+ elsif definition[:"screenshot_#{mode}_url"]
+ Discourse.base_path + definition[:"screenshot_#{mode}_url"]
+ end
end
end
diff --git a/frontend/discourse/app/components/design-wizard/theme-section.gjs b/frontend/discourse/app/components/design-wizard/theme-section.gjs
index 6bdf65102e7..cd4d16c17cd 100644
--- a/frontend/discourse/app/components/design-wizard/theme-section.gjs
+++ b/frontend/discourse/app/components/design-wizard/theme-section.gjs
@@ -8,10 +8,8 @@ import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";
import dIcon from "discourse/ui-kit/helpers/d-icon";
import { i18n } from "discourse-i18n";
-// matches ThemeScreenshotThumbnails, so the card reserves the right box
-// before the image arrives
const SCREENSHOT_WIDTH = 800;
-const SCREENSHOT_HEIGHT = 450;
+const SCREENSHOT_HEIGHT = 500;
class ThemeCard extends Component {
@service interfaceColor;
diff --git a/lib/design_wizard/themes.rb b/lib/design_wizard/themes.rb
index 06c45ecdf2e..6883c109da4 100644
--- a/lib/design_wizard/themes.rb
+++ b/lib/design_wizard/themes.rb
@@ -7,8 +7,8 @@ module DesignWizard
remote_url: "https://github.com/discourse/discourse-concord-theme",
supports_welcome_banner: false,
supports_search: false,
- screenshot_light_url: "/images/design-wizard/concord-light.jpg",
- screenshot_dark_url: "/images/design-wizard/concord-dark.jpg",
+ screenshot_light_url: "/images/design-wizard/concord-light.webp",
+ screenshot_dark_url: "/images/design-wizard/concord-dark.webp",
}.freeze
def self.selectable
diff --git a/public/images/design-wizard/README.md b/public/images/design-wizard/README.md
new file mode 100644
index 00000000000..13ade50b829
--- /dev/null
+++ b/public/images/design-wizard/README.md
@@ -0,0 +1,32 @@
+# Design wizard theme previews
+
+The wizard uses these dedicated illustrations instead of uploaded theme screenshots.
+Each theme has a light and dark WebP at 1600 × 1000 (8:5). The image dimensions in
+`design-wizard/theme-section.gjs` and the frame in `design-wizard.scss` must keep
+this aspect ratio. Preserve the full header and both horizontal edges; Concord
+also needs its right-hand member list.
+
+These assets were generated with the built-in image generation tool from full-width
+Foundation, Horizon, and Concord screenshots. Text is abstracted into subdued
+strokes while navigation icons, surfaces, theme colors, and content structure
+remain recognizable. The dark versions are illustrative default palettes, not
+previews of the user's selected color scheme.
+
+## Prompt recipe
+
+For light versions, use a full-width screenshot as the reference. Request a
+faithful flat UI silhouette, preserving the header, top-right controls, sidebar,
+and theme-specific cards, table, or conversation columns. Replace text with thin,
+low-contrast gray strokes, with slightly darker titles. Keep the original icons
+and accent colors. Avoid decorative gradients, shadows, oversized rounding, and
+invented controls. Shorten vertical empty space to fit an 8:5 frame without
+cropping either horizontal edge.
+
+For dark versions, use the approved light illustration as the reference. Change
+only colors: charcoal main surface (#222222), darker sidebar/header (#191919),
+fine borders (#383838), and subdued text strokes (#53565b and #666a70). Horizon
+uses a muted dark-purple outer shell (#211f30), charcoal main panel (#242424), and
+lavender accents. Preserve composition, icons, avatars, controls, and columns.
+
+Export to WebP at quality 85. Check all six assets together at the actual wizard
+card size before replacing them.
diff --git a/public/images/design-wizard/concord-dark.jpg b/public/images/design-wizard/concord-dark.jpg
deleted file mode 100644
index 1712399ed0c..00000000000
Binary files a/public/images/design-wizard/concord-dark.jpg and /dev/null differ
diff --git a/public/images/design-wizard/concord-dark.webp b/public/images/design-wizard/concord-dark.webp
new file mode 100644
index 00000000000..ba2e1ee00e1
Binary files /dev/null and b/public/images/design-wizard/concord-dark.webp differ
diff --git a/public/images/design-wizard/concord-light.jpg b/public/images/design-wizard/concord-light.jpg
deleted file mode 100644
index 1bbfbfb567b..00000000000
Binary files a/public/images/design-wizard/concord-light.jpg and /dev/null differ
diff --git a/public/images/design-wizard/concord-light.webp b/public/images/design-wizard/concord-light.webp
new file mode 100644
index 00000000000..4a311cb0250
Binary files /dev/null and b/public/images/design-wizard/concord-light.webp differ
diff --git a/public/images/design-wizard/foundation-dark.webp b/public/images/design-wizard/foundation-dark.webp
new file mode 100644
index 00000000000..b6e58fe1d76
Binary files /dev/null and b/public/images/design-wizard/foundation-dark.webp differ
diff --git a/public/images/design-wizard/foundation-light.webp b/public/images/design-wizard/foundation-light.webp
new file mode 100644
index 00000000000..c09275c166c
Binary files /dev/null and b/public/images/design-wizard/foundation-light.webp differ
diff --git a/public/images/design-wizard/horizon-dark.webp b/public/images/design-wizard/horizon-dark.webp
new file mode 100644
index 00000000000..03d2706e6b8
Binary files /dev/null and b/public/images/design-wizard/horizon-dark.webp differ
diff --git a/public/images/design-wizard/horizon-light.webp b/public/images/design-wizard/horizon-light.webp
new file mode 100644
index 00000000000..81ff28196df
Binary files /dev/null and b/public/images/design-wizard/horizon-light.webp differ
diff --git a/spec/requests/admin/config/design_wizard_controller_spec.rb b/spec/requests/admin/config/design_wizard_controller_spec.rb
index 042abe7a9b3..d0bc1ca826d 100644
--- a/spec/requests/admin/config/design_wizard_controller_spec.rb
+++ b/spec/requests/admin/config/design_wizard_controller_spec.rb
@@ -48,6 +48,10 @@ RSpec.describe Admin::Config::DesignWizardController do
expect(horizon_pair["dark"]["name"]).to eq("Horizon Dark")
foundation = themes.find { |theme| theme["id"] == Theme::CORE_THEMES["foundation"] }
+ expect(foundation).to include(
+ "screenshot_light_url" => "/images/design-wizard/foundation-light.webp",
+ "screenshot_dark_url" => "/images/design-wizard/foundation-dark.webp",
+ )
expect(foundation["palette_pairs"].map { |pair| pair["key"] }).to eq(
%w[default wcag solarized dracula],
)
@@ -89,8 +93,8 @@ RSpec.describe Admin::Config::DesignWizardController do
"palette_pairs" => [],
"supports_welcome_banner" => false,
"supports_search" => false,
- "screenshot_light_url" => "/images/design-wizard/concord-light.jpg",
- "screenshot_dark_url" => "/images/design-wizard/concord-dark.jpg",
+ "screenshot_light_url" => "/images/design-wizard/concord-light.webp",
+ "screenshot_dark_url" => "/images/design-wizard/concord-dark.webp",
)
end
@@ -182,8 +186,8 @@ RSpec.describe Admin::Config::DesignWizardController do
"color_scheme_id" => palette.id,
"supports_welcome_banner" => false,
"supports_search" => false,
- "screenshot_light_url" => "/images/design-wizard/concord-light.jpg",
- "screenshot_dark_url" => "/images/design-wizard/concord-dark.jpg",
+ "screenshot_light_url" => "/images/design-wizard/concord-light.webp",
+ "screenshot_dark_url" => "/images/design-wizard/concord-dark.webp",
)
expect(response.parsed_body["current_theme"]).to be_nil
expect(response.parsed_body["palettes_user_selectable"]).to eq(true)
@@ -210,36 +214,10 @@ RSpec.describe Admin::Config::DesignWizardController do
end
end
- it "serves the full-size screenshot and schedules a resize when none exists yet" do
- expect_enqueued_with(
- job: :generate_theme_screenshot_thumbnails,
- args: {
- theme_id: Theme::CORE_THEMES["horizon"],
- },
- ) { expect(serialized_horizon["screenshot_light_url"]).to eq(upload.url) }
- end
-
- it "only schedules the resize once while it is outstanding" do
- serialized_horizon
-
- expect { serialized_horizon }.not_to change {
- Jobs::GenerateThemeScreenshotThumbnails.jobs.size
- }
- end
-
- it "serves the resized screenshot once it has been generated" do
- Jobs::GenerateThemeScreenshotThumbnails.new.execute(
- theme_id: Theme::CORE_THEMES["horizon"],
- )
-
- url = serialized_horizon["screenshot_light_url"]
-
- expect(url).not_to eq(upload.url)
- expect(OptimizedImage.find_by(upload_id: upload.id)).to have_attributes(
- url:,
- width: ThemeScreenshotThumbnails::WIDTH,
- height: ThemeScreenshotThumbnails::HEIGHT,
- extension: ".webp",
+ it "uses the bundled previews even when the theme has an uploaded screenshot" do
+ expect(serialized_horizon).to include(
+ "screenshot_light_url" => "/images/design-wizard/horizon-light.webp",
+ "screenshot_dark_url" => "/images/design-wizard/horizon-dark.webp",
)
end
end