diff --git a/packages/builder/src/builderStore/store/theme.js b/packages/builder/src/builderStore/store/theme.js
index cb4d0a2774..fd6b05df59 100644
--- a/packages/builder/src/builderStore/store/theme.js
+++ b/packages/builder/src/builderStore/store/theme.js
@@ -3,14 +3,25 @@ import { localStorageStore } from "./localStorage"
export const getThemeStore = () => {
const themeElement = document.documentElement
const initialValue = {
- darkMode: true,
+ theme: "darkest",
+ options: ["lightest", "light", "dark", "darkest"],
}
const store = localStorageStore("bb-theme", initialValue)
- // Update theme when store changes
- store.subscribe(theme => {
- themeElement.classList.toggle("spectrum--darkest", theme.darkMode)
- themeElement.classList.toggle("spectrum--lightest", !theme.darkMode)
+ // Update theme class when store changes
+ store.subscribe(state => {
+ // Handle any old local storage values - this can be removed after the update
+ if (state.darkMode !== undefined) {
+ store.set(initialValue)
+ return
+ }
+
+ state.options.forEach(option => {
+ themeElement.classList.toggle(
+ `spectrum--${option}`,
+ option === state.theme
+ )
+ })
})
return store
diff --git a/packages/builder/src/components/settings/ThemeEditor.svelte b/packages/builder/src/components/settings/ThemeEditor.svelte
index 9c7235ce62..d971f01764 100644
--- a/packages/builder/src/components/settings/ThemeEditor.svelte
+++ b/packages/builder/src/components/settings/ThemeEditor.svelte
@@ -1,8 +1,11 @@
-
+