From aa3da817ddc01fd5597b1feaee5f2c742cfe03b4 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Sat, 20 Feb 2021 10:21:41 -0600 Subject: [PATCH] Disable dark splash in embed --- src/playground/index.ejs | 2 ++ webpack.config.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/playground/index.ejs b/src/playground/index.ejs index 6dd4ea989..08da52354 100644 --- a/src/playground/index.ejs +++ b/src/playground/index.ejs @@ -42,8 +42,10 @@ document.querySelector('#splash-troubleshooting').textContent = messages[2]; } document.querySelector('#splash-content').style.display = 'block'; + <% if (!htmlWebpackPlugin.options.noTheme) { %> try {var localTheme = localStorage.getItem('tw:theme');} catch (e) {} if (localTheme ? localTheme === 'dark' : window.matchMedia('(prefers-color-scheme: dark)').matches) document.querySelector('#splash').setAttribute('splash-theme', 'dark'); + <% } %> })();
diff --git a/webpack.config.js b/webpack.config.js index 2a3558d59..f0c8973a3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -176,6 +176,7 @@ module.exports = [ template: 'src/playground/index.ejs', filename: 'embed.html', title: 'Embedded Project - TurboWarp', + noTheme: true, ...htmlWebpackPluginCommon }), new HtmlWebpackPlugin({