Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(webv2): add Catppuccin Mocha theme
Josh Corbette1337ee3c44c
diff --git a/invokeai/frontend/webv2/index.html b/invokeai/frontend/webv2/index.htmlindex fedfbf66ab..ad2393cdd2 100644--- a/invokeai/frontend/webv2/index.html+++ b/invokeai/frontend/webv2/index.html@@ -21,6 +21,7 @@mono: 'dark',osakaJade: 'dark',ultradark: 'dark',+ catppuccinMocha: 'dark',};var id = localStorage.getItem('invokeai:v7:webv2:theme');if (!id) {diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsxindex f914b6c610..4900008ed5 100644--- a/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx+++ b/invokeai/frontend/webv2/src/features/workflow/ui/WorkflowUiContext.tsx@@ -1,5 +1,6 @@import type { ForLoopValidationReason } from '@features/workflow/core/forLoops';import type { ProjectGraphState } from '@features/workflow/core/types';+import type { WorkbenchThemeId } from '@theme/themes';import type { ReactNode } from 'react';import { useExternalStoreSelector, type EqualityFn } from '@platform/state/selectors';@@ -15,7 +16,7 @@ import type {export interface WorkflowPreferences {reduceMotion: boolean;- themeId: 'classic' | 'light' | 'osakaJade' | 'mono' | 'ultradark';+ themeId: WorkbenchThemeId;workflowEdgeStyle: 'curved' | 'square';workflowEdgesBehindNodes: boolean;workflowShowMinimap: boolean;diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json b/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.jsonindex 2d58f20946..cc8969b03c 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json+++ b/invokeai/frontend/webv2/src/platform/ui/theme/__fixtures__/legacyTokenBaseline.json@@ -233,5 +233,52 @@"accent.emphasized": "color-mix(in oklab, oklch(80.623% 0.1248 228.24) 36%, oklch(11.5% 0.003 250))","accent.focusRing": "oklch(80.623% 0.1248 228.24)","accent.border": "oklch(80.623% 0.1248 228.24)"+ },+ "catppuccinMocha": {+ "bg": "oklch(18.28% 0.0204 284.2)",+ "bg.subtle": "oklch(21.55% 0.0254 284.06)",+ "bg.muted": "oklch(24.29% 0.0304 283.91)",+ "bg.panel": "oklch(24.29% 0.0304 283.91)",+ "bg.emphasized": "oklch(32.4% 0.0319 281.98)",+ "bg.inset": "oklch(18.28% 0.0204 284.2)",+ "bg.error": "color-mix(in oklab, oklch(75.56% 0.1297 2.76) 14%, oklch(21.55% 0.0254 284.06))",+ "bg.success": "color-mix(in oklab, oklch(85.77% 0.1092 142.72) 14%, oklch(21.55% 0.0254 284.06))",+ "bg.warning": "color-mix(in oklab, oklch(82.37% 0.1015 52.63) 14%, oklch(21.55% 0.0254 284.06))",+ "fg": "oklch(87.87% 0.0426 272.28)",+ "fg.muted": "oklch(68.65% 0.0374 274.73)",+ "fg.subtle": "oklch(61.76% 0.0367 276)",+ "fg.grid": "oklch(40.37% 0.032 280.15)",+ "fg.error": "oklch(75.56% 0.1297 2.76)",+ "fg.success": "oklch(85.77% 0.1092 142.72)",+ "fg.warning": "oklch(82.37% 0.1015 52.63)",+ "border": "oklch(40.37% 0.032 280.15)",+ "border.subtle": "oklch(40.37% 0.032 280.15)",+ "border.muted": "oklch(40.37% 0.032 280.15)",+ "border.emphasized": "oklch(47.65% 0.034 278.64)",+ "border.error": "oklch(75.56% 0.1297 2.76)",+ "gray.contrast": "oklch(18.28% 0.0204 284.2)",+ "gray.fg": "oklch(87.87% 0.0426 272.28)",+ "gray.subtle": "oklch(36.4% 0.0319 281.06)",+ "gray.muted": "oklch(32.4% 0.0319 281.98)",+ "gray.emphasized": "oklch(47.65% 0.034 278.64)",+ "gray.solid": "oklch(87.87% 0.0426 272.28)",+ "gray.focusRing": "oklch(76.64% 0.1113 259.88)",+ "gray.border": "oklch(47.65% 0.034 278.64)",+ "brand.solid": "oklch(78.71% 0.1187 304.77)",+ "brand.contrast": "oklch(18.28% 0.0204 284.2)",+ "brand.fg": "oklch(78.71% 0.1187 304.77)",+ "brand.subtle": "color-mix(in oklab, oklch(78.71% 0.1187 304.77) 16%, oklch(21.55% 0.0254 284.06))",+ "brand.muted": "color-mix(in oklab, oklch(78.71% 0.1187 304.77) 26%, oklch(21.55% 0.0254 284.06))",+ "brand.emphasized": "color-mix(in oklab, oklch(78.71% 0.1187 304.77) 36%, oklch(21.55% 0.0254 284.06))",+ "brand.focusRing": "oklch(76.64% 0.1113 259.88)",+ "brand.border": "oklch(78.71% 0.1187 304.77)",+ "accent.solid": "oklch(76.64% 0.1113 259.88)",+ "accent.contrast": "oklch(18.28% 0.0204 284.2)",+ "accent.fg": "oklch(76.64% 0.1113 259.88)",+ "accent.subtle": "color-mix(in oklab, oklch(76.64% 0.1113 259.88) 16%, oklch(21.55% 0.0254 284.06))",+ "accent.muted": "color-mix(in oklab, oklch(76.64% 0.1113 259.88) 26%, oklch(21.55% 0.0254 284.06))",+ "accent.emphasized": "color-mix(in oklab, oklch(76.64% 0.1113 259.88) 36%, oklch(21.55% 0.0254 284.06))",+ "accent.focusRing": "oklch(76.64% 0.1113 259.88)",+ "accent.border": "oklch(76.64% 0.1113 259.88)"}}diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.ts b/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.tsindex a991d2e389..4a9649767d 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/__tokenResolve.ts@@ -25,9 +25,10 @@ const dataSel = (id: string): string => `&:root[data-theme=${id}]`;export const THEME_SELECTORS: Record<string, string[]> = {classic: [DARK_SEL, BASE_SEL], // default theme: no [data-theme=classic] rulelight: [dataSel('light'), LIGHT_SEL, BASE_SEL],- osakaJade: [dataSel('osakaJade'), DARK_SEL, BASE_SEL],- mono: [dataSel('mono'), DARK_SEL, BASE_SEL],ultradark: [dataSel('ultradark'), DARK_SEL, BASE_SEL],+ mono: [dataSel('mono'), DARK_SEL, BASE_SEL],+ osakaJade: [dataSel('osakaJade'), DARK_SEL, BASE_SEL],+ catppuccinMocha: [dataSel('catppuccinMocha'), DARK_SEL, BASE_SEL],};export const THEMES = Object.keys(THEME_SELECTORS);diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/prePaintThemeMap.test.ts b/invokeai/frontend/webv2/src/platform/ui/theme/prePaintThemeMap.test.tsnew file mode 100644index 0000000000..a735d64d08--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/theme/prePaintThemeMap.test.ts@@ -0,0 +1,38 @@+import { describe, expect, it } from 'vitest';++import { resolveWorkbenchThemeId, THEMES, THEMES_BY_ID } from './themes';++const indexHtmlModules = import.meta.glob('../../../../index.html', { eager: true, import: 'default', query: '?raw' });++/** The `themeColorSchemes` literal the pre-paint script in index.html keeps by hand. */+const readPrePaintThemeMap = (): Record<string, string> => {+ const html = Object.values(indexHtmlModules)[0];+ if (typeof html !== 'string') {+ throw new TypeError('index.html was not loaded');+ }+ const literal = /var themeColorSchemes = \{([^}]*)\}/.exec(html)?.[1];+ if (!literal) {+ throw new Error('index.html no longer declares themeColorSchemes');+ }+ return Object.fromEntries(+ [...literal.matchAll(/(\w+):\s*'(\w+)'/g)].map((match) => [match[1] as string, match[2] as string])+ );+};++describe('pre-paint theme map', () => {+ const map = readPrePaintThemeMap();++ it('lists every registered theme with its color scheme', () => {+ for (const theme of THEMES) {+ expect(map[theme.id], theme.id).toBe(theme.colorScheme);+ }+ });++ it('maps every listed id, legacy ids included, to a registered theme with the same color scheme', () => {+ for (const [id, colorScheme] of Object.entries(map)) {+ const themeId = resolveWorkbenchThemeId(id);+ expect(themeId, id).not.toBeNull();+ expect(colorScheme, id).toBe(THEMES_BY_ID[themeId!].colorScheme);+ }+ });+});diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.test.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.test.tsindex 294fbad799..cf44f43a9a 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.test.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.test.ts@@ -1,9 +1,10 @@import { describe, expect, it } from 'vitest';import legacyBaseline from './__fixtures__/legacyTokenBaseline.json';-import { CONSUMER_TOKENS, resolveToken, THEMES, type TokenSystem } from './__tokenResolve';+import { CONSUMER_TOKENS, resolveToken, THEME_SELECTORS, THEMES, type TokenSystem } from './__tokenResolve';import { progressCircleSlotRecipe } from './recipes';import { system } from './system';+import { THEMES as THEME_DEFINITIONS } from './themes';const sys = system as unknown as TokenSystem;const STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const;@@ -31,6 +32,10 @@ describe('color token contract — legacy-value gate', () => {});describe('ramp + mapping structure', () => {+ it('resolves every registered theme (a theme missing from THEME_SELECTORS would skip the gate)', () => {+ expect(Object.keys(THEME_SELECTORS)).toEqual(THEME_DEFINITIONS.map((theme) => theme.id));+ });+it('emits every neutral ramp step for every theme', () => {for (const theme of THEMES) {for (const step of STEPS) {@@ -57,7 +62,7 @@ describe('ramp + mapping structure', () => {it('uses pure black/white low-opacity image outlines by color mode', () => {expect(resolveToken(sys, 'light', 'border.image')).toBe('oklch(0 0 0 / 0.1)');- for (const theme of ['classic', 'osakaJade', 'mono', 'ultradark']) {+ for (const theme of ['classic', 'osakaJade', 'mono', 'ultradark', 'catppuccinMocha']) {expect(resolveToken(sys, theme, 'border.image')).toBe('oklch(1 0 0 / 0.1)');}});diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/themes.ts b/invokeai/frontend/webv2/src/platform/ui/theme/themes.tsindex e034c96f6f..8167dc0c3a 100644--- a/invokeai/frontend/webv2/src/platform/ui/theme/themes.ts+++ b/invokeai/frontend/webv2/src/platform/ui/theme/themes.ts@@ -1,4 +1,4 @@-export type WorkbenchThemeId = 'classic' | 'light' | 'osakaJade' | 'mono' | 'ultradark';+export type WorkbenchThemeId = 'classic' | 'light' | 'osakaJade' | 'mono' | 'ultradark' | 'catppuccinMocha';/*** Steps of the neutral ramp. `50` is the lightest, `950` the darkest — the same@@ -195,6 +195,38 @@ const ultradark: ThemeColors = {control: 'oklch(19% 0.004 250)',};+// Catppuccin Mocha (https://catppuccin.com), converted from the published sRGB+// hex values. The ramp is the palette's own neutral ladder — Crust/Mantle/Base as+// the app, subtle and panel surfaces, Surface0–2 for controls and borders,+// Overlay/Subtext/Text for foregrounds — so every step is a palette color.+// Mauve carries the brand, Blue the accent.+const catppuccinMocha: ThemeColors = {+ neutral: {+ 50: 'oklch(87.87% 0.0426 272.28)', // Text+ 100: 'oklch(81.68% 0.0403 272.86)', // Subtext1+ 200: 'oklch(75.1% 0.0396 273.93)', // Subtext0+ 300: 'oklch(68.65% 0.0374 274.73)', // Overlay2+ 400: 'oklch(61.76% 0.0367 276)', // Overlay1+ 500: 'oklch(47.65% 0.034 278.64)', // Surface2+ 600: 'oklch(40.37% 0.032 280.15)', // Surface1+ 700: 'oklch(32.4% 0.0319 281.98)', // Surface0+ 800: 'oklch(24.29% 0.0304 283.91)', // Base+ 900: 'oklch(21.55% 0.0254 284.06)', // Mantle+ 950: 'oklch(18.28% 0.0204 284.2)', // Crust+ },+ brand: { solid: 'oklch(78.71% 0.1187 304.77)', contrast: 'oklch(18.28% 0.0204 284.2)' }, // Mauve on Crust+ accent: { solid: 'oklch(76.64% 0.1113 259.88)', contrast: 'oklch(18.28% 0.0204 284.2)' }, // Blue on Crust+ danger: 'oklch(75.56% 0.1297 2.76)', // Red+ success: 'oklch(85.77% 0.1092 142.72)', // Green+ warning: 'oklch(82.37% 0.1015 52.63)', // Peach+ inset: 'oklch(18.28% 0.0204 284.2)', // Crust+ // The palette has no step between Surface0 and Surface1; the fill sits at+ // their midpoint so ghost hovers and subtle badges stay visible on controls.+ fill: 'oklch(36.4% 0.0319 281.06)',+ grid: 'oklch(40.37% 0.032 280.15)', // Surface1+ control: 'oklch(32.4% 0.0319 281.98)', // Surface0+};+/*** Theme registry. Order here is the display order in the Settings picker.* `THEMES` is the single source of truth consumed by both the token builder@@ -216,11 +248,11 @@ export const THEMES: ThemeDefinition[] = [colors: light,},{- id: 'osakaJade',- label: 'Osaka Jade',- description: 'Deep jade stone with a cool green accent.',+ id: 'ultradark',+ label: 'Ultra Dark',+ description: 'Pure-black OLED surfaces for low-light rooms.',colorScheme: 'dark',- colors: osakaJade,+ colors: ultradark,},{id: 'mono',@@ -230,11 +262,18 @@ export const THEMES: ThemeDefinition[] = [colors: mono,},{- id: 'ultradark',- label: 'Ultra Dark',- description: 'Pure-black OLED surfaces for low-light rooms.',+ id: 'osakaJade',+ label: 'Osaka Jade',+ description: 'Deep jade stone with a cool green accent.',colorScheme: 'dark',- colors: ultradark,+ colors: osakaJade,+ },+ {+ id: 'catppuccinMocha',+ label: 'Catppuccin Mocha',+ description: 'Soothing pastel accents on deep violet-gray surfaces.',+ colorScheme: 'dark',+ colors: catppuccinMocha,},];