From 9da5cf56ee87a3b9565a4722805d395afcaf457e Mon Sep 17 00:00:00 2001 From: kingjosht <294681058+kingjosht@users.noreply.github.com> Date: Wed, 24 Jun 2026 18:20:46 -0700 Subject: [PATCH 1/3] fixed theme and accent colors not saving --- src/lib/themes/themePersistance.js | 35 +++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/lib/themes/themePersistance.js b/src/lib/themes/themePersistance.js index 6eeed51f509..cfef0a69a13 100644 --- a/src/lib/themes/themePersistance.js +++ b/src/lib/themes/themePersistance.js @@ -1,5 +1,7 @@ import {BLOCKS_CUSTOM, Theme} from '.'; +const STORAGE_KEY = 'ct:theme'; + const matchMedia = query => (window.matchMedia ? window.matchMedia(query) : null); const PREFERS_HIGH_CONTRAST_QUERY = matchMedia('(prefers-contrast: more)'); const PREFERS_DARK_QUERY = matchMedia('(prefers-color-scheme: dark)'); @@ -11,19 +13,20 @@ const systemPreferencesTheme = () => { // Check for URL search parameters first (highest priority) const urlParams = new URLSearchParams(window.location.search); const modeParam = urlParams.get('mode'); - + // Check for mode parameter on any page if (modeParam === 'dark') { return Theme.dark; } else if (modeParam === 'light') { return Theme.light; } - + // If on home page, default to light theme - if (window.location.pathname === "/" || window.location.pathname.includes("/index.html") || window.location.pathname === "/build/") { + // eslint-disable-next-line max-len + if (window.location.pathname === '/' || window.location.pathname.includes('/index.html') || window.location.pathname === '/build/') { return Theme.light; } - + if (PREFERS_HIGH_CONTRAST_QUERY && PREFERS_HIGH_CONTRAST_QUERY.matches) { return Theme.highContrast; } @@ -62,7 +65,29 @@ const onSystemPreferenceChange = onChange => { */ const detectTheme = () => { const systemPreferences = systemPreferencesTheme(); - return systemPreferences; + let theme = systemPreferences; + + try { + const stored = localStorage.getItem(STORAGE_KEY); + if (stored) { + const parsed = JSON.parse(stored); + if (parsed) { + if (parsed.accent) { + theme = theme.set('accent', parsed.accent); + } + if (parsed.gui) { + theme = theme.set('gui', parsed.gui); + } + if (parsed.blocks && parsed.blocks !== BLOCKS_CUSTOM) { + theme = theme.set('blocks', parsed.blocks); + } + } + } + } catch (e) { + // ignore + } + + return theme; }; /** From 3339383be57cfa816bb12b3c83f9b1ba8fb90bba Mon Sep 17 00:00:00 2001 From: kingjosht <294681058+kingjosht@users.noreply.github.com> Date: Wed, 24 Jun 2026 18:21:13 -0700 Subject: [PATCH 2/3] fixed default asset IDs to ensure they are loaded locally rather then from remote --- src/lib/default-project/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/default-project/index.js b/src/lib/default-project/index.js index 72ec444cd88..4be0de13758 100644 --- a/src/lib/default-project/index.js +++ b/src/lib/default-project/index.js @@ -38,13 +38,13 @@ const defaultProject = translator => { dataFormat: 'SVG', data: encoder.encode(backdrop) }, { - id: '927d672925e7b99f7813735c484c6922', + id: '3ffb86585ebbb654fbc092ea9b0a41b3', assetType: 'ImageVector', dataFormat: 'SVG', data: encoder.encode(costume1) }, { - id: 'f1b8a0c2e3e4f5a6b7c8d9e0f1a2b3c4', + id: '2e11410044fca296f1623ae28a7abff4', assetType: 'ImageVector', dataFormat: 'SVG', data: encoder.encode(costume2) From fbd180fbfac0772ae2d88acb08585018becb3765 Mon Sep 17 00:00:00 2001 From: kingjosht <294681058+kingjosht@users.noreply.github.com> Date: Wed, 24 Jun 2026 18:23:50 -0700 Subject: [PATCH 3/3] fixed typo from IS_STANDLALONE to IS_STANDALONE --- src/lib/storage.js | 2 +- webpack.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/storage.js b/src/lib/storage.js index 4f0cd1ba290..a741fcc0629 100644 --- a/src/lib/storage.js +++ b/src/lib/storage.js @@ -4,7 +4,7 @@ import defaultProject from './default-project'; // eslint-disable-next-line import/no-commonjs const {TRUSTED_IFRAME_HOST} = require('./brand.js'); -const isStandAlone = process.env.IS_STANDLALONE === 'true'; +const isStandAlone = process.env.IS_STANDALONE === 'true'; /** * Wrapper for ScratchStorage which adds default web sources. diff --git a/webpack.config.js b/webpack.config.js index b16976e1f5f..76210f705cc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -197,7 +197,7 @@ module.exports = [ 'process.env.FORCE_EMBED': JSON.stringify(process.env.FORCE_EMBED || 'true'), 'process.env.COLLABORATION_HOST': JSON.stringify(process.env.COLLABORATION_HOST || 'wss://collaborator.codetorch.net/'), 'process.env.COLLABORATION_DEV_MODE': JSON.stringify(process.env.COLLABORATION_DEV_MODE || 'false'), - 'process.env.IS_STANDLALONE': JSON.stringify(process.env.IS_STANDLALONE || 'false') + 'process.env.IS_STANDALONE': JSON.stringify(process.env.IS_STANDALONE || 'false') }), new HtmlWebpackPlugin({ chunks: ['editor'],