diff --git a/editor/src/components/code-editor/vscode-editor-loading-screen.tsx b/editor/src/components/code-editor/vscode-editor-loading-screen.tsx index 893456b67ffb..3a30c14e28a2 100644 --- a/editor/src/components/code-editor/vscode-editor-loading-screen.tsx +++ b/editor/src/components/code-editor/vscode-editor-loading-screen.tsx @@ -161,9 +161,7 @@ export const VSCodeLoadingScreen = React.memo((): React.ReactElement | null => { width: 140, }} > -
- -
+ storyboard.js @@ -229,9 +227,7 @@ export const VSCodeLoadingScreen = React.memo((): React.ReactElement | null => { justifyContent: 'center', }} > -
- -
+
diff --git a/editor/src/uuiui/button.tsx b/editor/src/uuiui/button.tsx index a9eed9c5cafc..111a224fd293 100644 --- a/editor/src/uuiui/button.tsx +++ b/editor/src/uuiui/button.tsx @@ -115,7 +115,7 @@ export const FormButton = styled.button((props: ButtonProps) => ({ backgroundColor: props.primary ? props.danger ? colorTheme.errorForeground.value - : colorTheme.primarySubdued.value + : colorTheme.primary.value : colorTheme.emphasizedBackgroundPop.value, color: props.primary ? 'white' : props.danger ? colorTheme.errorForeground.value : 'inherit', @@ -153,7 +153,7 @@ export const FormButton = styled.button((props: ButtonProps) => ({ backgroundColor: props.primary ? props.danger ? colorTheme.errorForegroundEmphasized.value - : colorTheme.primaryEmphasized.value + : colorTheme.primary.value : colorTheme.emphasizedBackgroundReduced.value, }, })) diff --git a/editor/src/uuiui/styles/theme/base.ts b/editor/src/uuiui/styles/theme/base.ts deleted file mode 100644 index f37dd57f6f74..000000000000 --- a/editor/src/uuiui/styles/theme/base.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createUtopiColor } from '../utopi-color-helpers' - -export const base = { - blue: createUtopiColor('lch(50 85 280 / 1)'), - blue10: createUtopiColor('lch(50 85 280 / 10%)'), - blue30: createUtopiColor('lch(50 85 280 / 30%)'), - purple: createUtopiColor('lch(39 129 307 / 1)'), - purple70: createUtopiColor('lch(39 129 307 / 70%)'), - purple05: createUtopiColor('lch(39 129 307 / 5%)'), - red: createUtopiColor('lch(57 100 16 / 1)'), - orange: createUtopiColor('lch(81 111 79 / 1)'), - orange20: createUtopiColor('lch(81 111 79 / 20%)'), - neonpink: createUtopiColor('lch(62 122 330 / 1)'), - neonpink30: createUtopiColor('lch(62 122 330 / 30%)'), - neongreen: createUtopiColor('lch(88 100 157)'), - jsYellow: createUtopiColor('#b7b73b'), - almostBlack: createUtopiColor('hsl(0,0%,10%)'), - white: createUtopiColor('white'), - offWhite: createUtopiColor('#eee'), - black: createUtopiColor('black'), - darkgray: createUtopiColor('hsl(0, 0%, 50%)'), - darkorange: createUtopiColor('lch(55 109.96 54.75)'), - transparent: createUtopiColor('transparent'), -} diff --git a/editor/src/uuiui/styles/theme/dark.ts b/editor/src/uuiui/styles/theme/dark.ts index adfc5368d79e..5bfb333bb830 100644 --- a/editor/src/uuiui/styles/theme/dark.ts +++ b/editor/src/uuiui/styles/theme/dark.ts @@ -1,27 +1,27 @@ -import { createUtopiColor } from '../utopi-color-helpers' -import { base } from './base' +import { createUtopiColor, enforceUtopiColorTheme } from '../utopi-color-helpers' import type { light } from './light' const darkBase = { - primary: base.blue, - primarySubdued: createUtopiColor('rgba(0,118,247,1)'), - primaryEmphasized: createUtopiColor('rgba(26,135,255,1)'), - component: base.purple, - componentChild: base.orange, - css: base.neongreen, - white: base.white, - black: base.black, - brandPurple: base.purple, + primary: createUtopiColor('oklch(59% 0.25 254)'), + primary10: createUtopiColor('oklch(59% 0.25 254 / 10%)'), + primary30: createUtopiColor('oklch(59% 0.25 254 / 30%)'), + component: createUtopiColor('oklch(53% 0.31 290)'), + componentChild: createUtopiColor('oklch(83.6% 0.198 81.5)'), + componentChild20: createUtopiColor('oklch(83.6% 0.198 81.5 / 20%)'), + css: createUtopiColor('oklch(86.6% 0.27 158.6)'), + white: createUtopiColor('oklch(100% 0 0)'), + black: createUtopiColor('oklch(0% 0 0)'), + brandPurple: createUtopiColor('oklch(53% 0.31 290)'), + brandPurple70: createUtopiColor('oklch(53% 0.31 290 / 70%)'), brandNeonPink: createUtopiColor('oklch(78.64% 0.237 327.81)'), brandNeonPink10: createUtopiColor('oklch(78.64% 0.237 327.81 / 10%)'), - brandNeonGreen: base.neongreen, + brandNeonGreen: createUtopiColor('oklch(86.6% 0.27 158.6)'), pinkSubdued: createUtopiColor('oklch(33% 0.07 327)'), - jsYellow: base.jsYellow, - secondaryBlue: createUtopiColor('#679AD1'), - secondaryOrange: createUtopiColor('#E89A74'), - denimBlue: createUtopiColor('#133763'), - lightDenimBlue: createUtopiColor('#072140'), - transparent: base.transparent, + secondaryBlue: createUtopiColor('oklch(75.44% 0.138 251.22)'), + secondaryOrange: createUtopiColor('oklch(81.8% 0.141 47)'), + denimBlue: createUtopiColor('oklch(33.65% 0.09 255)'), + lightDenimBlue: createUtopiColor('oklch(25% 0.07 255)'), + transparent: createUtopiColor('oklch(0% 0 0 / 0%)'), error: createUtopiColor('oklch(67.99% 0.261 22.81)'), componentOrange: createUtopiColor('oklch(80.6% 0.15 50)'), componentPurple: createUtopiColor('oklch(76% 0.155 300)'), @@ -85,7 +85,7 @@ const darkErrorStates = { errorForeground: darkBase.error, // TODO vv only used by button, refactor button and remove errorForegroundEmphasized: createUtopiColor('rgba(245,0,57,1)'), - warningForeground: base.orange, + warningForeground: darkBase.componentChild, // TODO vv only used by image-thumbnail-control, consider removing warningBgTranslucent: createUtopiColor('rgba(250, 94, 0, 0.2)'), warningBgSolid: createUtopiColor('rgba(252,142,77,1)'), @@ -101,22 +101,19 @@ const colorsWithOpacity = { neutralInvertedBackground20: createUtopiColor('rgba(217, 220, 227, 0.2)'), neutralInvertedBackground30: createUtopiColor('rgba(217, 220, 227, 0.3)'), listNewItemFlashBackground0: createUtopiColor('rgba(211, 254, 162, 0)'), - brandPurple70: base.purple70, + // TODO vv only used by button, refactor & remove errorForeground20: createUtopiColor('rgba(253, 0, 59, 0.2)'), - primary10: base.blue10, - primary30: base.blue30, subduedBorder80: createUtopiColor('rgba(24, 28, 32, 0.8)'), } -export const dark: typeof light = { +const darkTheme: typeof light = { ...colorsWithOpacity, ...darkBase, ...darkPrimitives, ...darkErrorStates, - textColor: base.white, - + textColor: darkBase.white, panelShadowColor: createUtopiColor('rgba(0,0,0, .3)'), seperator: createUtopiColor('#282B35'), @@ -141,7 +138,7 @@ export const dark: typeof light = { canvasControlsSizeBoxBorder: createUtopiColor('hsl(0,0%,15%)'), canvasControlReorderSliderBoxShadowPrimary: createUtopiColor('rgba(52,52,52,0.35)'), canvasControlReorderSliderBoxShadowSecondary: createUtopiColor('rgba(166,166,166,0.82)'), - canvasControlsCoordinateSystemMarks: base.neonpink, + canvasControlsCoordinateSystemMarks: darkBase.brandNeonPink, canvasControlsImmediateParentMarks: createUtopiColor('rgba(0,0,0,0.25)'), // TODO vv refactor - only used by self-layout-subsection indirection canvasControlsInlineIndicatorInactive: createUtopiColor('rgba(179,215,255,1)'), @@ -155,21 +152,21 @@ export const dark: typeof light = { canvasControlsDimensionableControlShadow: createUtopiColor('rgba(140,140,140,.9)'), canvasSelectionPrimaryOutline: darkBase.primary, - canvasSelectionInstanceOutline: base.purple, - canvasSelectionSceneOutline: base.purple, - canvasSelectionRandomDOMElementInstanceOutline: base.darkgray, + canvasSelectionInstanceOutline: darkBase.brandPurple, + canvasSelectionSceneOutline: darkBase.brandPurple, + canvasSelectionRandomDOMElementInstanceOutline: createUtopiColor('oklch(59.82% 0 0)'), canvasSelectionSecondaryOutline: createUtopiColor('rgba(217, 220, 227, 0.5)'), // fg1 - canvasSelectionNotFocusable: base.darkgray, + canvasSelectionNotFocusable: createUtopiColor('oklch(59.82% 0 0)'), - canvasSelectionFocusable: base.purple, - canvasSelectionIsolatedComponent: base.purple, + canvasSelectionFocusable: darkBase.brandPurple, + canvasSelectionIsolatedComponent: darkBase.brandPurple, //Children of isolated component - canvasSelectionNotFocusableChild: base.darkorange, - canvasSelectionFocusableChild: base.purple, + canvasSelectionNotFocusableChild: createUtopiColor('oklch(63% 0.22 41)'), + canvasSelectionFocusableChild: darkBase.brandPurple, - canvasLayoutStroke: base.neonpink, + canvasLayoutStroke: darkBase.brandNeonPink, - paddingForeground: base.neongreen, + paddingForeground: darkBase.brandNeonGreen, paddingFillTranslucent: createUtopiColor('rgba(230,248,230,0.9)'), canvasElementBackground: createUtopiColor('rgba(230,242,255,1)'), @@ -191,8 +188,8 @@ export const dark: typeof light = { // application utilities: navigatorResizeHintBorder: darkBase.primary, navigatorComponentName: darkBase.primary, - navigatorComponentSelected: base.orange20, - navigatorComponentIconBorder: base.orange, + navigatorComponentSelected: darkBase.componentChild20, + navigatorComponentIconBorder: darkBase.componentChild, contextMenuBackground: darkPrimitives.secondaryBackground, contextMenuForeground: darkPrimitives.neutralForeground, @@ -203,7 +200,7 @@ export const dark: typeof light = { inspectorHoverColor: darkBase.fg8, inspectorFocusedColor: darkBase.dynamicBlue, inspectorSetBorderColor: darkPrimitives.neutralBorder, - flasherHookColor: base.neonpink, + flasherHookColor: darkBase.brandNeonPink, // Github pane githubBoxesBorder: createUtopiColor('#282a2d'), @@ -228,5 +225,7 @@ export const dark: typeof light = { codeEditorGrid: createUtopiColor('#6d705b'), // Gap controls - gapControls: base.neongreen, + gapControls: darkBase.brandNeonGreen, } + +export const dark = enforceUtopiColorTheme(darkTheme) diff --git a/editor/src/uuiui/styles/theme/light.ts b/editor/src/uuiui/styles/theme/light.ts index b4558f3daca9..3d38d25c1e25 100644 --- a/editor/src/uuiui/styles/theme/light.ts +++ b/editor/src/uuiui/styles/theme/light.ts @@ -1,33 +1,34 @@ -import { rgb } from 'chroma-js' -import { createUtopiColor } from '../utopi-color-helpers' -import { base } from './base' +import { MapLike } from 'typescript' +import { UtopiColor, createUtopiColor, enforceUtopiColorTheme } from '../utopi-color-helpers' +import type { dark } from './dark' const lightBase = { - primary: base.blue, - primarySubdued: createUtopiColor('rgba(0,118,247,1)'), - primaryEmphasized: createUtopiColor('rgba(26,135,255,1)'), - component: base.purple, - componentChild: base.orange, + primary: createUtopiColor('oklch(59% 0.25 254)'), + primary10: createUtopiColor('oklch(59% 0.25 254 / 10%)'), + primary30: createUtopiColor('oklch(59% 0.25 254 / 30%)'), + component: createUtopiColor('oklch(53% 0.31 290)'), + componentChild: createUtopiColor('oklch(83.6% 0.198 81.5)'), + componentChild20: createUtopiColor('oklch(83.6% 0.198 81.5 / 20%)'), css: createUtopiColor('oklch(69% 0.18 166.76)'), - white: base.white, - black: base.black, - brandPurple: base.purple, - brandNeonPink: base.neonpink, + white: createUtopiColor('oklch(100% 0 0)'), + black: createUtopiColor('oklch(0% 0 0)'), + brandPurple: createUtopiColor('oklch(53% 0.31 290)'), + brandPurple70: createUtopiColor('oklch(53% 0.31 290 / 70%)'), + brandNeonPink: createUtopiColor('oklch(72.2% 0.36 331.7)'), brandNeonPink10: createUtopiColor('oklch(72.53% 0.353 331.69 / 10%)'), - brandNeonGreen: base.neongreen, + brandNeonGreen: createUtopiColor('oklch(86.6% 0.27 158.6)'), pinkSubdued: createUtopiColor('oklch(92% 0.076 326)'), - jsYellow: base.jsYellow, - secondaryBlue: createUtopiColor('#49B6FF'), - secondaryOrange: createUtopiColor('#EEA544'), - denimBlue: createUtopiColor('#CEE5FF'), - lightDenimBlue: createUtopiColor('#EDF5FF'), - transparent: base.transparent, - error: base.red, - componentOrange: createUtopiColor('lch(61% 89 50)'), - componentPurple: base.purple, - componentPurple05: base.purple05, + secondaryBlue: createUtopiColor('oklch(74.5% 0.14 241.9)'), + secondaryOrange: createUtopiColor('oklch(78.97% 0.192 70)'), + denimBlue: createUtopiColor('oklch(91.3% 0.04 252)'), + lightDenimBlue: createUtopiColor('oklch(97% 0.02 254)'), + transparent: createUtopiColor('oklch(0% 0 0 / 0%)'), + error: createUtopiColor('oklch(66% 0.3 11.65)'), + componentOrange: createUtopiColor('oklch(68% 0.2 42)'), + componentPurple: createUtopiColor('oklch(53% 0.31 290)'), + componentPurple05: createUtopiColor('oklch(53.19% 0.307 289.7 / 5%)'), componentPurple05solid: createUtopiColor('oklch(0.96 0.02 286)'), - dynamicBlue: base.blue, + dynamicBlue: createUtopiColor('oklch(59% 0.25 254)'), dynamicBlue10: createUtopiColor('oklch(58.98% 0.246 254.39 / 10%)'), unavailable: createUtopiColor('oklch(54.52% 0 0 / 5%)'), unavailableGrey: createUtopiColor('oklch(0% 0 0 / 22%)'), @@ -61,7 +62,7 @@ const lightPrimitives = { // backgrounds emphasizedBackground: lightBase.bg0, emphasizedBackgroundPop: lightBase.bg1, - emphasizedBackgroundReduced: base.white, + emphasizedBackgroundReduced: lightBase.white, neutralBackground: lightBase.bg1, secondaryBackground: lightBase.bg2, subtleBackground: lightBase.bg3, @@ -77,15 +78,15 @@ const lightPrimitives = { secondaryBorder: lightBase.border2, subduedBorder: lightBase.border1, - checkerboardLight: base.white, + checkerboardLight: createUtopiColor('oklch(100% 0 0)'), checkerboardDark: createUtopiColor('rgb(247 247 247)'), } const lightErrorStates = { - errorForeground: base.red, + errorForeground: createUtopiColor('oklch(66% 0.3 11.65)'), errorForegroundEmphasized: createUtopiColor('rgba(245,0,57,1)'), // TODO vv only used by button, refactor button and remove - warningForeground: base.orange, + warningForeground: createUtopiColor('oklch(83.6% 0.198 81.5)'), // TODO vv only used by image-thumbnail-control, consider removing warningBgTranslucent: createUtopiColor('rgba(250, 94, 0, 0.2)'), warningBgSolid: createUtopiColor('rgba(252,142,77,1)'), @@ -102,21 +103,18 @@ const colorsWithOpacity = { neutralInvertedBackground30: createUtopiColor('hsla(0,0%,0%,0.3)'), // the following is used with an animation to zero opacity but same colour value listNewItemFlashBackground0: createUtopiColor('rgba(211, 254, 162, 0)'), - brandPurple70: base.purple70, // TODO vv only used by button, refactor & remove errorForeground20: createUtopiColor('rgba(253, 0, 59, 0.2)'), - primary10: base.blue10, - primary30: base.blue30, subduedBorder80: createUtopiColor('hsla(0, 0%, 91%, 0.8)'), } -export const light = { +const lightTheme = { ...colorsWithOpacity, ...lightBase, ...lightPrimitives, ...lightErrorStates, - textColor: base.almostBlack, + textColor: createUtopiColor('oklch(21.56% 0 0)'), panelShadowColor: createUtopiColor('rgba(0,0,0, .3)'), seperator: createUtopiColor('hsl(0,0%,92%)'), @@ -142,7 +140,7 @@ export const light = { canvasControlsSizeBoxBorder: createUtopiColor('hsl(0,0%,15%)'), canvasControlReorderSliderBoxShadowPrimary: createUtopiColor('rgba(52,52,52,0.35)'), canvasControlReorderSliderBoxShadowSecondary: createUtopiColor('hsl(0,0%,0%,0.5)'), - canvasControlsCoordinateSystemMarks: base.neonpink, + canvasControlsCoordinateSystemMarks: lightBase.brandNeonPink, canvasControlsImmediateParentMarks: createUtopiColor('rgba(0, 0, 0, 0.25)'), canvasControlsInlineIndicatorInactive: createUtopiColor('rgba(179,215,255,1)'), canvasControlsInlineToggleUnsetText: createUtopiColor('rgba(179,215,255,1)'), @@ -154,21 +152,21 @@ export const light = { canvasControlsDimensionableControlShadow: createUtopiColor('rgba(140,140,140,.9)'), canvasSelectionPrimaryOutline: lightBase.primary, - canvasSelectionInstanceOutline: base.purple, - canvasSelectionSceneOutline: base.purple, - canvasSelectionRandomDOMElementInstanceOutline: base.darkgray, + canvasSelectionInstanceOutline: lightBase.brandPurple, + canvasSelectionSceneOutline: lightBase.brandPurple, + canvasSelectionRandomDOMElementInstanceOutline: createUtopiColor('oklch(59.82% 0 0)'), canvasSelectionSecondaryOutline: createUtopiColor('hsla(0,0%,10%,0.5)'), - canvasSelectionNotFocusable: base.darkgray, + canvasSelectionNotFocusable: createUtopiColor('oklch(59.82% 0 0)'), - canvasSelectionFocusable: base.purple, - canvasSelectionIsolatedComponent: base.purple, + canvasSelectionFocusable: lightBase.brandPurple, + canvasSelectionIsolatedComponent: lightBase.brandPurple, //Children of isolated component - canvasSelectionNotFocusableChild: base.darkorange, - canvasSelectionFocusableChild: base.purple, + canvasSelectionNotFocusableChild: createUtopiColor('oklch(63% 0.22 41)'), + canvasSelectionFocusableChild: lightBase.brandPurple, - canvasLayoutStroke: base.neonpink, + canvasLayoutStroke: lightBase.brandNeonPink, - paddingForeground: base.neongreen, + paddingForeground: lightBase.brandNeonGreen, paddingFillTranslucent: createUtopiColor('rgba(230,248,230,0.7)'), canvasElementBackground: createUtopiColor('rgba(230,242,255,1)'), @@ -190,19 +188,19 @@ export const light = { // application utilities: navigatorResizeHintBorder: lightBase.primary, navigatorComponentName: lightBase.primary, - navigatorComponentSelected: base.orange20, - navigatorComponentIconBorder: base.orange, + navigatorComponentSelected: lightBase.componentChild20, + navigatorComponentIconBorder: lightBase.componentChild, contextMenuBackground: lightPrimitives.secondaryBackground, contextMenuForeground: lightPrimitives.neutralForeground, - contextMenuHighlightForeground: base.white, + contextMenuHighlightForeground: lightBase.white, contextMenuHighlightBackground: lightBase.primary, contextMenuSeparator: createUtopiColor('rgba(0,0,0,0.1)'), inspectorHoverColor: lightBase.fg8, inspectorFocusedColor: lightBase.primary, inspectorSetBorderColor: lightPrimitives.neutralBorder, - flasherHookColor: base.neonpink, + flasherHookColor: lightBase.brandNeonPink, // Github pane githubBoxesBorder: createUtopiColor('#2D2E33'), @@ -229,3 +227,6 @@ export const light = { // Gap controls gapControls: createUtopiColor('#FFA500'), } + +// all values in light must be of the type UtopiColor! This will break if you made a mistake. +export const light = enforceUtopiColorTheme(lightTheme) diff --git a/editor/src/uuiui/styles/theme/utopia-theme.ts b/editor/src/uuiui/styles/theme/utopia-theme.ts index ee5b7f52d686..ea9e484d94ff 100644 --- a/editor/src/uuiui/styles/theme/utopia-theme.ts +++ b/editor/src/uuiui/styles/theme/utopia-theme.ts @@ -1,4 +1,4 @@ -import { base } from './base' +import { color } from '../utopitrons' import { dark } from './dark' import { light } from './light' import type { ThemeObject } from './theme-helpers' @@ -110,43 +110,43 @@ const scene = { const noticeStyles: { [styleName: string]: React.CSSProperties } = { info: { - backgroundColor: base.almostBlack.cssValue, - color: base.offWhite.cssValue, + backgroundColor: colorTheme.fg1.value, + color: colorTheme.white.value, }, warning: { - backgroundColor: base.almostBlack.cssValue, - color: base.offWhite.cssValue, + backgroundColor: colorTheme.fg1.value, + color: colorTheme.white.value, }, notice: { - backgroundColor: base.blue.cssValue, - color: 'white', + backgroundColor: colorTheme.primary.value, + color: colorTheme.white.value, }, success: { - backgroundColor: base.blue.cssValue, - color: base.offWhite.cssValue, + backgroundColor: colorTheme.primary.value, + color: colorTheme.white.value, }, primary: { - backgroundColor: base.blue.cssValue, - color: base.offWhite.cssValue, + backgroundColor: colorTheme.primary.value, + color: colorTheme.white.value, }, error: { - backgroundColor: base.red.cssValue, - color: base.offWhite.cssValue, + backgroundColor: colorTheme.error.value, + color: colorTheme.white.value, }, disconnected: { - backgroundColor: base.almostBlack.cssValue, - color: base.offWhite.cssValue, + backgroundColor: colorTheme.fg1.value, + color: colorTheme.white.value, }, } const textNoticeStyles = { info: {}, - success: { color: base.neongreen.cssValue }, - primary: { color: base.blue.cssValue }, - notice: { color: base.darkgray.cssValue }, - warning: { color: base.red.cssValue }, - error: { color: base.red.cssValue }, - disconnected: { background: base.black.value, color: 'white' }, + success: { color: colorTheme.brandNeonGreen.value }, + primary: { color: colorTheme.primary.value }, + notice: { color: colorTheme.fg5.value }, + warning: { color: colorTheme.error.value }, + error: { color: colorTheme.error.value }, + disconnected: { background: colorTheme.black.value, color: colorTheme.white.value }, } const fontStyles = { diff --git a/editor/src/uuiui/styles/utopi-color-helpers.ts b/editor/src/uuiui/styles/utopi-color-helpers.ts index 23487017ee0f..279339320583 100644 --- a/editor/src/uuiui/styles/utopi-color-helpers.ts +++ b/editor/src/uuiui/styles/utopi-color-helpers.ts @@ -9,3 +9,7 @@ export function createUtopiColor( ): UtopiColor { return { value: `var(${path})`, cssValue: baseColor } } + +export function enforceUtopiColorTheme(theme: T): T { + return theme +}