Skip to content

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.

feat(models): give model bases distinct badge colors

Josh Corbetta562784a17a3
diff --git a/invokeai/frontend/webv2/src/features/models/core/baseIdentity.test.ts b/invokeai/frontend/webv2/src/features/models/core/baseIdentity.test.ts
index 02782735b4..7cc1d7e87e 100644
--- a/invokeai/frontend/webv2/src/features/models/core/baseIdentity.test.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/baseIdentity.test.ts
@@ -34,7 +34,7 @@ describe('MODEL_BASES', () => {
});
expect(getModelBaseInfo('sd-2')).toMatchObject({
label: 'SD 2.x',
- colorPalette: 'teal',
+ colorPalette: 'sage',
supportsDiffusersConversion: true,
});
expect(getModelBaseInfo('sdxl')).toMatchObject({
@@ -42,9 +42,9 @@ describe('MODEL_BASES', () => {
colorPalette: 'blue',
supportsDiffusersConversion: true,
});
- expect(getModelBaseInfo('flux2')).toMatchObject({ label: 'FLUX.2', colorPalette: 'cyan' });
+ expect(getModelBaseInfo('flux2')).toMatchObject({ label: 'FLUX.2', colorPalette: 'ice' });
expect(getModelBaseInfo('qwen-image')).toMatchObject({ label: 'Qwen Image', colorPalette: 'cyan' });
- expect(getModelBaseInfo('minimax-h3')).toMatchObject({ label: 'MiniMax H3', colorPalette: 'orange' });
+ expect(getModelBaseInfo('minimax-h3')).toMatchObject({ label: 'MiniMax H3', colorPalette: 'coral' });
expect(isConvertibleToDiffusers(createModel({ base: 'sdxl', format: 'checkpoint', type: 'main' }))).toBe(true);
expect(isConvertibleToDiffusers(createModel({ base: 'flux', format: 'checkpoint', type: 'main' }))).toBe(false);
});
diff --git a/invokeai/frontend/webv2/src/features/models/core/baseIdentity.ts b/invokeai/frontend/webv2/src/features/models/core/baseIdentity.ts
index dc310c6acb..a2863c7a27 100644
--- a/invokeai/frontend/webv2/src/features/models/core/baseIdentity.ts
+++ b/invokeai/frontend/webv2/src/features/models/core/baseIdentity.ts
@@ -7,7 +7,24 @@ import type { ModelBase, ModelConfig } from './types';
export const toTitleCase = (value: string): string =>
value.replaceAll(/[_-]+/g, ' ').replace(/\w\S*/g, (word) => word.charAt(0).toUpperCase() + word.slice(1));
-export type ModelBaseColorPalette = 'blue' | 'cyan' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'teal';
+export type ModelBaseColorPalette =
+ | 'blue'
+ | 'coral'
+ | 'cyan'
+ | 'gold'
+ | 'gray'
+ | 'green'
+ | 'ice'
+ | 'lavender'
+ | 'orange'
+ | 'periwinkle'
+ | 'pink'
+ | 'purple'
+ | 'red'
+ | 'sage'
+ | 'silver'
+ | 'steel'
+ | 'teal';
export interface ModelBaseInfo {
base: ModelBase;
@@ -32,7 +49,7 @@ export const MODEL_BASES = {
base: 'sd-2',
label: 'SD 2.x',
longLabel: 'Stable Diffusion 2.x',
- colorPalette: 'teal',
+ colorPalette: 'sage',
supportsDiffusersConversion: true,
},
sdxl: {
@@ -46,7 +63,7 @@ export const MODEL_BASES = {
base: 'sdxl-refiner',
label: 'SDXL Refiner',
longLabel: 'Stable Diffusion XL Refiner',
- colorPalette: 'blue',
+ colorPalette: 'steel',
},
'sd-3': {
base: 'sd-3',
@@ -62,7 +79,7 @@ export const MODEL_BASES = {
flux2: {
base: 'flux2',
label: 'FLUX.2',
- colorPalette: 'cyan',
+ colorPalette: 'ice',
},
cogview4: {
base: 'cogview4',
@@ -82,17 +99,17 @@ export const MODEL_BASES = {
'z-image': {
base: 'z-image',
label: 'Z-Image',
- colorPalette: 'orange',
+ colorPalette: 'gold',
},
'ideogram-4': {
base: 'ideogram-4',
label: 'Ideogram 4',
- colorPalette: 'pink',
+ colorPalette: 'lavender',
},
'krea-2': {
base: 'krea-2',
label: 'Krea-2',
- colorPalette: 'pink',
+ colorPalette: 'silver',
},
anima: {
base: 'anima',
@@ -102,13 +119,13 @@ export const MODEL_BASES = {
wan: {
base: 'wan',
label: 'Wan 2.2',
- colorPalette: 'cyan',
+ colorPalette: 'periwinkle',
description: 'Video architecture used for image generation at a single frame.',
},
'minimax-h3': {
base: 'minimax-h3',
label: 'MiniMax H3',
- colorPalette: 'orange',
+ colorPalette: 'coral',
description: 'Video architecture that generates video with synchronized audio.',
},
any: {
diff --git a/invokeai/frontend/webv2/src/features/models/ui/detail/ModelBadges.browser.test.tsx b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelBadges.browser.test.tsx
new file mode 100644
index 0000000000..42c7e6b083
--- /dev/null
+++ b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelBadges.browser.test.tsx
@@ -0,0 +1,85 @@
+import { Badge, Box, ChakraProvider, HStack } from '@chakra-ui/react';
+import { MODEL_BASES } from '@features/models/core/baseIdentity';
+import { applyThemeToRoot } from '@theme/applyTheme';
+import { getContrastRatio, toRgb } from '@theme/contrastRatio.testing';
+import { system } from '@theme/system';
+import { THEMES } from '@theme/themes';
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, expect, it } from 'vitest';
+
+import { ModelBaseBadge } from './ModelBadges';
+
+let host: HTMLDivElement | null = null;
+let root: Root | null = null;
+const UPDATED_BASES = new Set([
+ 'sd-2',
+ 'sdxl-refiner',
+ 'flux2',
+ 'z-image',
+ 'ideogram-4',
+ 'krea-2',
+ 'wan',
+ 'minimax-h3',
+]);
+(globalThis as typeof globalThis & { IS_REACT_ACT_ENVIRONMENT: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+
+afterEach(async () => {
+ await act(() => root?.unmount());
+ host?.remove();
+ host = null;
+ root = null;
+ applyThemeToRoot('classic');
+});
+
+it('keeps base badges distinct and readable through theme changes and filter selection', async () => {
+ host = document.createElement('div');
+ document.body.append(host);
+ root = createRoot(host);
+ await act(() => {
+ root?.render(
+ <ChakraProvider value={system}>
+ <Box bg="bg.panel" p="4" width="400px">
+ {Object.values(MODEL_BASES).map(({ base, label, colorPalette }) => (
+ <HStack key={base} data-base={base} gap="4" mb="2">
+ <ModelBaseBadge base={base} />
+ <Badge colorPalette={colorPalette} size="sm" variant="solid">
+ {label}
+ </Badge>
+ </HStack>
+ ))}
+ </Box>
+ </ChakraProvider>
+ );
+ });
+
+ for (const theme of THEMES) {
+ applyThemeToRoot(theme.id);
+ const identities = new Set<string>();
+ for (const { base, colorPalette } of Object.values(MODEL_BASES)) {
+ const badges = host.querySelectorAll(`[data-base="${base}"] .chakra-badge`);
+ expect(badges).toHaveLength(2);
+ const surface = getComputedStyle(badges[0]!);
+ const solid = getComputedStyle(badges[1]!);
+ if (colorPalette !== 'gray') {
+ const identity = toRgb(surface.color).join(',');
+ expect(identities.has(identity), `${theme.id}: duplicate ${base} foreground`).toBe(false);
+ identities.add(identity);
+ }
+ if (UPDATED_BASES.has(base)) {
+ for (const [variant, style] of [
+ ['surface', surface],
+ ['solid', solid],
+ ] as const) {
+ expect(
+ getContrastRatio(style.color, style.backgroundColor, 1),
+ `${theme.id}: ${base} ${variant} text contrast`
+ ).toBeGreaterThanOrEqual(4.5);
+ }
+ }
+ if (base === 'ideogram-4' && theme.colorScheme === 'dark') {
+ expect(toRgb(surface.color)).toEqual([189, 159, 255]);
+ }
+ }
+ }
+});
diff --git a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
index 41930cf04e..2c20cc7d98 100644
--- a/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
+++ b/invokeai/frontend/webv2/src/platform/ui/theme/system.ts
@@ -146,6 +146,38 @@ const accentSolid: Compute = (theme) => theme.colors.accent.solid;
/** The neutral ramp, emitted as `neutral.50…neutral.950`, one value per theme. */
const neutralRamp = Object.fromEntries(STEPS.map((step) => [step, colorToken((theme) => theme.colors.neutral[step])]));
+// Additional categorical hues. Seeds are dark-theme foregrounds; light themes
+// darken them for text, and every fill derives from the same hue and surface.
+const categoricalPalettes = Object.fromEntries(
+ Object.entries({
+ coral: '#ff8e80',
+ gold: '#f6d365',
+ ice: '#b3e5fc',
+ lavender: '#bd9fff',
+ periwinkle: '#a5b4fc',
+ sage: '#a3b18a',
+ silver: '#d4d4d5',
+ steel: '#94aec9',
+ }).map(([name, seed]) => {
+ const fg: Compute = (theme) =>
+ theme.colorScheme === 'light' ? `color-mix(in oklab, ${seed} 40%, ${theme.colors.neutral[950]})` : seed;
+ return [
+ name,
+ {
+ fg: colorToken(fg),
+ solid: colorToken(fg),
+ contrast: stepRef(950, 50),
+ subtle: mix(fg, 12, surface),
+ muted: mix(fg, 24, surface),
+ emphasized: mix(fg, 36, surface),
+ border: colorToken(fg),
+ focusRing: colorToken(fg),
+ hoverTint: colorToken(fg),
+ },
+ ];
+ })
+);
+
/**
* The semantic-token contract. Backgrounds/foregrounds/borders reference ramp
* steps (`stepRef`); the four off-ramp neutrals and the status/identity hues read
@@ -153,6 +185,7 @@ const neutralRamp = Object.fromEntries(STEPS.map((step) => [step, colorToken((th
* verbatim so built-ins inherit the theme for free.
*/
const semanticColors = {
+ ...categoricalPalettes,
neutral: neutralRamp,
// Surface ladder. Light panels are whiter than the app bg, so the light steps