diff --git a/packages/bbui/src/Tooltip/Tooltip.svelte b/packages/bbui/src/Tooltip/Tooltip.svelte index 50a3242d1e..ea511b0060 100644 --- a/packages/bbui/src/Tooltip/Tooltip.svelte +++ b/packages/bbui/src/Tooltip/Tooltip.svelte @@ -26,5 +26,9 @@ diff --git a/packages/builder/src/builderStore/store/theme.js b/packages/builder/src/builderStore/store/theme.js index bd3a149d63..54323ba55f 100644 --- a/packages/builder/src/builderStore/store/theme.js +++ b/packages/builder/src/builderStore/store/theme.js @@ -1,11 +1,10 @@ -import { createLocalStorageStore } from "@budibase/frontend-core" +import { Constants, createLocalStorageStore } from "@budibase/frontend-core" export const getThemeStore = () => { const themeElement = document.documentElement const initialValue = { theme: "darkest", - options: ["lightest", "light", "dark", "darkest", "nord"], } const store = createLocalStorageStore("bb-theme", initialValue) @@ -17,11 +16,14 @@ export const getThemeStore = () => { return } - state.options.forEach(option => { + Constants.ThemeOptions.forEach(option => { themeElement.classList.toggle( `spectrum--${option}`, option === state.theme ) + + // Ensure darkest is always added as this is the base class for custom + // themes themeElement.classList.add("spectrum--darkest") }) }) diff --git a/packages/builder/src/main.js b/packages/builder/src/main.js index bc5ec4f009..dc1e1cf1bf 100644 --- a/packages/builder/src/main.js +++ b/packages/builder/src/main.js @@ -5,6 +5,8 @@ import "@spectrum-css/vars/dist/spectrum-darkest.css" import "@spectrum-css/vars/dist/spectrum-dark.css" import "@spectrum-css/vars/dist/spectrum-light.css" import "@spectrum-css/vars/dist/spectrum-lightest.css" +import "@budibase/frontend-core/src/themes/nord.css" +import "@budibase/frontend-core/src/themes/midnight.css" import "@spectrum-css/page/dist/index-vars.css" import "./global.css" import { suppressWarnings } from "./helpers/warnings" diff --git a/packages/builder/src/pages/builder/portal/settings/theming.svelte b/packages/builder/src/pages/builder/portal/settings/theming.svelte index 2a2aaa8a3b..2a8e82f0e5 100644 --- a/packages/builder/src/pages/builder/portal/settings/theming.svelte +++ b/packages/builder/src/pages/builder/portal/settings/theming.svelte @@ -2,6 +2,7 @@ import { Layout, Heading, Body, Divider, Label, Select } from "@budibase/bbui" import { themeStore } from "builderStore" import { capitalise } from "helpers" + import { Constants } from "@budibase/frontend-core" @@ -14,7 +15,7 @@ Builder theme diff --git a/packages/client/src/components/app/index.js b/packages/client/src/components/app/index.js index db8cc43ef6..c7b8f18643 100644 --- a/packages/client/src/components/app/index.js +++ b/packages/client/src/components/app/index.js @@ -1,10 +1,10 @@ import "@spectrum-css/vars/dist/spectrum-global.css" import "@spectrum-css/vars/dist/spectrum-medium.css" import "@spectrum-css/vars/dist/spectrum-large.css" -import "@spectrum-css/vars/dist/spectrum-lightest.css" -import "@spectrum-css/vars/dist/spectrum-light.css" -import "@spectrum-css/vars/dist/spectrum-dark.css" import "@spectrum-css/vars/dist/spectrum-darkest.css" +import "@spectrum-css/vars/dist/spectrum-dark.css" +import "@spectrum-css/vars/dist/spectrum-light.css" +import "@spectrum-css/vars/dist/spectrum-lightest.css" import "@spectrum-css/page/dist/index-vars.css" // Non user-facing components @@ -35,6 +35,7 @@ export { default as embeddedmap } from "./embedded-map/EmbeddedMap.svelte" export * from "./charts" export * from "./forms" export * from "./table" + export * from "./blocks" export * from "./dynamic-filter" diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index 00af4127e4..011c0041e9 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -98,3 +98,12 @@ export const SqlNumberTypeRangeMap = { min: -8388608, }, } + +export const ThemeOptions = [ + "lightest", + "light", + "dark", + "darkest", + "nord", + "midnight", +] diff --git a/packages/frontend-core/src/themes/midnight.css b/packages/frontend-core/src/themes/midnight.css new file mode 100644 index 0000000000..528d847702 --- /dev/null +++ b/packages/frontend-core/src/themes/midnight.css @@ -0,0 +1,16 @@ +.spectrum--midnight { + --hue: 220; + --sat: 10%; + --spectrum-global-color-gray-50: hsl(var(--hue), var(--sat), 12%); + --spectrum-global-color-gray-75: hsl(var(--hue), var(--sat), 15%); + --spectrum-global-color-gray-100: hsl(var(--hue), var(--sat), 17%); + --spectrum-global-color-gray-200: hsl(var(--hue), var(--sat), 20%); + --spectrum-global-color-gray-300: hsl(var(--hue), var(--sat), 24%); + --spectrum-global-color-gray-400: hsl(var(--hue), var(--sat), 32%); + --spectrum-global-color-gray-500: hsl(var(--hue), var(--sat), 40%); + --spectrum-global-color-gray-600: hsl(var(--hue), var(--sat), 60%); + --spectrum-global-color-gray-700: hsl(var(--hue), var(--sat), 70%); + --spectrum-global-color-gray-800: hsl(var(--hue), var(--sat), 80%); + --spectrum-global-color-gray-900: hsl(var(--hue), var(--sat), 95%); +} + diff --git a/packages/frontend-core/src/themes/nord.css b/packages/frontend-core/src/themes/nord.css new file mode 100644 index 0000000000..113adfb853 --- /dev/null +++ b/packages/frontend-core/src/themes/nord.css @@ -0,0 +1,46 @@ +.spectrum--nord { + --spectrum-global-color-red-400: #bf616a; + --spectrum-global-color-red-500: #c26971; + --spectrum-global-color-red-600: #c57179; + --spectrum-global-color-red-700: #c97980; + --spectrum-global-color-static-red-400: #bf616a; + --spectrum-global-color-static-red-500: #c26971; + --spectrum-global-color-static-red-600: #c57179; + --spectrum-global-color-static-red-700: #c97980; + + --spectrum-global-color-green-400: #719453; + --spectrum-global-color-green-500: #789d58; + --spectrum-global-color-green-600: #7fa55e; + --spectrum-global-color-green-700: #86aa67; + --spectrum-global-color-static-green-400: #719453; + --spectrum-global-color-static-green-500: #789d58; + --spectrum-global-color-static-green-600: #7fa55e; + --spectrum-global-color-static-green-700: #86aa67; + + --spectrum-global-color-blue-400: #5680b4; + --spectrum-global-color-blue-500: #5e86b8; + --spectrum-global-color-blue-600: #668dbb; + --spectrum-global-color-blue-700: #6f93bf; + --spectrum-global-color-static-blue-200: #7799c4; + --spectrum-global-color-static-blue-300: #6f93bf; + --spectrum-global-color-static-blue-400: #668dbb; + --spectrum-global-color-static-blue-500: #5e86b8; + --spectrum-global-color-static-blue-600: #5680b4; + --spectrum-global-color-static-blue-700: #4e79af; + --spectrum-global-color-static-blue-800: #4a73a6; + + --spectrum-global-color-gray-50: #2e3440; + --spectrum-global-color-gray-75: #353b4a; + --spectrum-global-color-gray-100: #3b4252; + --spectrum-global-color-gray-200: #4a5367; + --spectrum-global-color-gray-300: #4c566a; + --spectrum-global-color-gray-400: #5a657d; + --spectrum-global-color-gray-500: #677590; + --spectrum-global-color-gray-600: #79869f; + --spectrum-global-color-gray-700: #a9b1c1; + --spectrum-global-color-gray-800: #bac1cd; + --spectrum-global-color-gray-900: #eceff4; + + --spectrum-alias-highlight-hover: rgba(169, 177, 193, 0.06); + --spectrum-alias-highlight-active: rgba(169, 177, 193, 0.1); +}