From 3c558d2eb60546657808d9b9da0e591e30837921 Mon Sep 17 00:00:00 2001
From: Joe <33972521+hnb-ku@users.noreply.github.com>
Date: Mon, 25 Jul 2022 18:02:21 +0800
Subject: [PATCH] UX: Prevent color flicker on dark themes (#17620)
Follow up to: #17619
Context: https://meta.discourse.org/t/introducing-discourse-splash-a-visual-preloader-displayed-while-site-assets-load/232003/17
We previously relied on the user's browser when deciding when to show the splash in light/dark mode. This worked well but can fail if the user manually selects a theme with a default "dark" scheme.
This PR will now factor that in. If the user selects a theme with a default dark scheme, use that. If a user selects a theme with a "light" default scheme and also picks a secondary "dark" scheme, use the media detection we had before.
This PR also removes the dark mode theme-color that was added in the previous PR. That will now go in a separate PR
---
app/views/common/_discourse_splash.html.erb | 90 ++++++++++++++-------
app/views/layouts/_head.html.erb | 3 +-
2 files changed, 60 insertions(+), 33 deletions(-)
diff --git a/app/views/common/_discourse_splash.html.erb b/app/views/common/_discourse_splash.html.erb
index 40bf5e07578..3ce1009a694 100644
--- a/app/views/common/_discourse_splash.html.erb
+++ b/app/views/common/_discourse_splash.html.erb
@@ -9,6 +9,11 @@
<%- end %>
-
-
+
<%- if Discourse.base_path.present? %>