Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(theme-neutral): tune destructive and non-semantic surfaces (#6049)

rubyycheungb2e6a1d6b0fb
diff --git a/.changeset/neutral-destructive-button-overlays.md b/.changeset/neutral-destructive-button-overlays.md
new file mode 100644
index 0000000000..75c040a1b4
--- /dev/null
+++ b/.changeset/neutral-destructive-button-overlays.md
@@ -0,0 +1,11 @@
+---
+'@astryxdesign/theme-neutral': patch
+'@astryxdesign/cli': patch
+---
+
+[fix] Use palette-backed red interaction overlays for Neutral destructive
+buttons, solid dark-palette tone-25 backgrounds (tone 20 for gray), and calmer
+dark-mode text colors. Use a palette-backed muted blue tint for dark info
+banners while preserving the existing light-mode non-semantic color mappings.
+
+@rubyycheung
diff --git a/packages/cli/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts b/packages/cli/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts
index eadc9c7f17..f8874b61b4 100644
--- a/packages/cli/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts
+++ b/packages/cli/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts
@@ -7,43 +7,43 @@
export const neutralPaletteRefs = {
purple: {
light: {30: '#6b187c', 70: '#d885eb', 75: '#e496f6', 80: '#efa8ff', 85: '#f3bfff', 90: '#f7d5ff'},
- dark: {85: '#f3bfff'},
+ dark: {25: '#4a2f51', 80: '#eaacf8'},
},
green: {
light: {30: '#0b5615', 40: '#237028', 45: '#2f7d33', 65: '#6ab26b', 75: '#90ca90', 80: '#a4d6a3'},
- dark: {80: '#aad4a9', 85: '#bce0bb'},
+ dark: {25: '#2b422b', 80: '#aad4a9', 85: '#bce0bb'},
},
neutral: {
light: {0: '#000000', 5: '#111111', 15: '#262626', 35: '#525252', 45: '#6a6a6a', 50: '#777777', 65: '#9e9e9e', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
- dark: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 35: '#525252', 65: '#9e9e9e', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
+ dark: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 20: '#303030', 35: '#525252', 65: '#9e9e9e', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
},
orange: {
light: {30: '#733100', 75: '#ff9e55', 85: '#ffc7a1'},
- dark: {65: '#df843f', 80: '#ffb37e', 85: '#ffc7a1'},
+ dark: {25: '#503424', 65: '#df843f', 80: '#ffb37e'},
},
blue: {
light: {30: '#00458c', 50: '#0074e2', 80: '#a1caff', 85: '#b9d7ff'},
- dark: {65: '#5aa0f8', 75: '#88bcff', 80: '#a1caff', 85: '#b9d7ff'},
+ dark: {25: '#253c5a', 65: '#5aa0f8', 75: '#88bcff', 80: '#a1caff'},
},
red: {
- light: {30: '#8a0011', 35: '#9e0015', 55: '#de4745', 65: '#fa6762', 80: '#ffaea7', 85: '#ffc4be'},
- dark: {75: '#ff9890', 80: '#ffaea7', 85: '#ffc4be'},
+ light: {30: '#8a0011', 35: '#9e0015', 55: '#de4745', 65: '#fa6762', 70: '#ff7f77', 80: '#ffaea7', 85: '#ffc4be'},
+ dark: {25: '#5b2b28', 65: '#ee736c', 75: '#ff9890', 80: '#ffaea7', 85: '#ffc4be'},
},
yellow: {
light: {30: '#584400', 40: '#745b00', 65: '#c29900', 75: '#e2b623', 80: '#eec448', 85: '#f8d36a'},
- dark: {80: '#e3c36c', 90: '#fae19e'},
+ dark: {25: '#453a1c', 80: '#e3c36c', 90: '#fae19e'},
},
teal: {
light: {30: '#005348', 80: '#90d7c8', 85: '#a9e2d6'},
- dark: {65: '#4fb1a0', 75: '#81c9bb'},
+ dark: {25: '#28413c', 65: '#4fb1a0', 75: '#81c9bb'},
},
cyan: {
- dark: {65: '#49adc4', 75: '#71c7dd', 80: '#85d5e9', 85: '#9ae2f4'},
+ dark: {25: '#274046', 65: '#49adc4', 75: '#71c7dd', 80: '#85d5e9', 85: '#9ae2f4'},
light: {30: '#00505f'},
},
pink: {
light: {30: '#83004b', 70: '#fc78b1', 85: '#ffc0d7'},
- dark: {75: '#fd92bd', 85: '#ffc0d7'},
+ dark: {25: '#572b3d', 75: '#fd92bd', 80: '#ffa9ca'},
},
} as const;
diff --git a/packages/cli/assets/templates/themes/neutral/neutralTheme.ts b/packages/cli/assets/templates/themes/neutral/neutralTheme.ts
index 894d9d2f57..b84518b071 100644
--- a/packages/cli/assets/templates/themes/neutral/neutralTheme.ts
+++ b/packages/cli/assets/templates/themes/neutral/neutralTheme.ts
@@ -37,6 +37,10 @@ const neutralLocalTokens: Record<string, TokenValue> = {
'--astryx-theme-neutral-color-status-fill-success': ['#198100', '#64af4c'],
'--astryx-theme-neutral-color-status-fill-warning': '#ffce2f',
'--astryx-theme-neutral-color-status-fill-error': ['#c9303a', '#ff705d'],
+ '--astryx-theme-neutral-color-status-muted-accent': [
+ blue.light[85],
+ withAlpha(blue.dark[75], '3D'),
+ ],
'--astryx-theme-neutral-color-on-tint-neutral': ['#fafafa4D', '#0a0a0a4D'],
'--astryx-theme-neutral-color-on-tint-overlay-hover': [
'#fafafa1A',
@@ -46,6 +50,14 @@ const neutralLocalTokens: Record<string, TokenValue> = {
'#fafafa33',
'#0a0a0a33',
],
+ '--astryx-theme-neutral-color-destructive-overlay-hover': [
+ withAlpha(red.light[70], '0D'),
+ withAlpha(red.dark[65], '0D'),
+ ],
+ '--astryx-theme-neutral-color-destructive-overlay-pressed': [
+ withAlpha(red.light[70], '1A'),
+ withAlpha(red.dark[65], '1A'),
+ ],
};
const statusFill = {
@@ -160,67 +172,55 @@ export const neutralTheme = defineTheme({
],
'--color-tint-hover': ['black', 'white'],
- '--color-background-red': [red.light[85], withAlpha(red.dark[75], '3D')],
+ '--color-background-red': [red.light[85], red.dark[25]],
'--color-border-red': [red.light[80], red.light[65]],
'--color-icon-red': [red.light[30], red.dark[75]],
- '--color-text-red': [red.light[30], red.dark[85]],
+ '--color-text-red': [red.light[30], red.dark[80]],
- '--color-background-orange': [
- orange.light[85],
- withAlpha(orange.light[75], '3D'),
- ],
+ '--color-background-orange': [orange.light[85], orange.dark[25]],
'--color-border-orange': [orange.light[85], orange.dark[65]],
'--color-icon-orange': [orange.light[30], orange.light[75]],
- '--color-text-orange': [orange.light[30], orange.dark[85]],
+ '--color-text-orange': [orange.light[30], orange.dark[80]],
- '--color-background-yellow': [
- yellow.dark[90],
- withAlpha(yellow.light[75], '3D'),
- ],
+ '--color-background-yellow': [yellow.dark[90], yellow.dark[25]],
'--color-border-yellow': [yellow.dark[80], yellow.light[65]],
'--color-icon-yellow': [yellow.light[30], yellow.light[75]],
- '--color-text-yellow': [yellow.light[30], yellow.light[85]],
+ '--color-text-yellow': [yellow.light[30], yellow.light[80]],
- '--color-background-green': [
- green.dark[85],
- withAlpha(green.light[75], '3D'),
- ],
+ '--color-background-green': [green.dark[85], green.dark[25]],
'--color-border-green': [green.dark[80], green.light[65]],
'--color-icon-green': [green.light[30], green.light[75]],
- '--color-text-green': [green.light[30], green.light[80]],
+ '--color-text-green': [green.light[30], green.light[75]],
- '--color-background-teal': [teal.light[85], withAlpha(teal.dark[75], '3D')],
+ '--color-background-teal': [teal.light[85], teal.dark[25]],
'--color-border-teal': [teal.light[80], teal.dark[65]],
'--color-icon-teal': [teal.light[30], teal.dark[75]],
- '--color-text-teal': [teal.light[30], teal.light[85]],
+ '--color-text-teal': [teal.light[30], teal.light[80]],
- '--color-background-cyan': [cyan.dark[85], withAlpha(cyan.dark[75], '3D')],
+ '--color-background-cyan': [cyan.dark[85], cyan.dark[25]],
'--color-border-cyan': [cyan.dark[80], cyan.dark[65]],
'--color-icon-cyan': [cyan.light[30], cyan.dark[75]],
- '--color-text-cyan': [cyan.light[30], cyan.dark[85]],
+ '--color-text-cyan': [cyan.light[30], cyan.dark[80]],
- '--color-background-blue': [blue.light[85], withAlpha(blue.dark[75], '3D')],
+ '--color-background-blue': [blue.light[85], blue.dark[25]],
'--color-border-blue': [blue.light[80], blue.dark[65]],
'--color-icon-blue': [blue.light[30], blue.dark[75]],
- '--color-text-blue': [blue.light[30], blue.dark[85]],
+ '--color-text-blue': [blue.light[30], blue.dark[80]],
- '--color-background-purple': [
- purple.light[90],
- withAlpha(purple.light[75], '3D'),
- ],
+ '--color-background-purple': [purple.light[90], purple.dark[25]],
'--color-border-purple': [purple.light[85], purple.light[70]],
'--color-icon-purple': [purple.light[30], purple.light[75]],
- '--color-text-purple': [purple.light[30], purple.dark[85]],
+ '--color-text-purple': [purple.light[30], purple.dark[80]],
- '--color-background-pink': [pink.light[85], withAlpha(pink.dark[75], '3D')],
+ '--color-background-pink': [pink.light[85], pink.dark[25]],
'--color-border-pink': [pink.light[85], pink.light[70]],
'--color-icon-pink': [pink.light[30], pink.dark[75]],
- '--color-text-pink': [pink.light[30], pink.dark[85]],
+ '--color-text-pink': [pink.light[30], pink.dark[80]],
- '--color-background-gray': [neutral.light[90], 'var(--color-neutral)'],
+ '--color-background-gray': [neutral.light[90], neutral.dark[20]],
'--color-border-gray': [neutral.light[85], neutral.dark[15]],
'--color-icon-gray': [neutral.light[35], neutral.dark[65]],
- '--color-text-gray': [neutral.light[15], neutral.dark[90]],
+ '--color-text-gray': [neutral.light[15], neutral.dark[85]],
// =========================================================================
// Radius — slightly larger than default (kept as-is)
@@ -277,6 +277,10 @@ export const neutralTheme = defineTheme({
'variant:destructive': {
backgroundColor: 'var(--color-error-muted)',
color: 'var(--color-error)',
+ '--color-overlay-hover':
+ 'var(--astryx-theme-neutral-color-destructive-overlay-hover)',
+ '--color-overlay-pressed':
+ 'var(--astryx-theme-neutral-color-destructive-overlay-pressed)',
},
},
@@ -387,7 +391,8 @@ export const neutralTheme = defineTheme({
'var(--astryx-theme-neutral-color-on-tint-overlay-pressed)',
},
'status:info': {
- '--color-accent-muted': 'var(--color-background-blue)',
+ '--color-accent-muted':
+ 'var(--astryx-theme-neutral-color-status-muted-accent)',
'--color-text-primary': 'var(--color-text-blue)',
'--color-text-secondary': 'var(--color-text-blue)',
'--color-accent': 'var(--color-text-blue)',
@@ -403,7 +408,6 @@ export const neutralTheme = defineTheme({
'--color-warning': 'var(--color-text-yellow)',
},
'status:error': {
- '--color-error-muted': 'var(--color-background-red)',
'--color-text-primary': 'var(--color-text-red)',
'--color-text-secondary': 'var(--color-text-red)',
'--color-error': 'var(--color-text-red)',
diff --git a/packages/themes/neutral/src/neutralPaletteRefs.generated.ts b/packages/themes/neutral/src/neutralPaletteRefs.generated.ts
index eadc9c7f17..f8874b61b4 100644
--- a/packages/themes/neutral/src/neutralPaletteRefs.generated.ts
+++ b/packages/themes/neutral/src/neutralPaletteRefs.generated.ts
@@ -7,43 +7,43 @@
export const neutralPaletteRefs = {
purple: {
light: {30: '#6b187c', 70: '#d885eb', 75: '#e496f6', 80: '#efa8ff', 85: '#f3bfff', 90: '#f7d5ff'},
- dark: {85: '#f3bfff'},
+ dark: {25: '#4a2f51', 80: '#eaacf8'},
},
green: {
light: {30: '#0b5615', 40: '#237028', 45: '#2f7d33', 65: '#6ab26b', 75: '#90ca90', 80: '#a4d6a3'},
- dark: {80: '#aad4a9', 85: '#bce0bb'},
+ dark: {25: '#2b422b', 80: '#aad4a9', 85: '#bce0bb'},
},
neutral: {
light: {0: '#000000', 5: '#111111', 15: '#262626', 35: '#525252', 45: '#6a6a6a', 50: '#777777', 65: '#9e9e9e', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
- dark: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 35: '#525252', 65: '#9e9e9e', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
+ dark: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 20: '#303030', 35: '#525252', 65: '#9e9e9e', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
},
orange: {
light: {30: '#733100', 75: '#ff9e55', 85: '#ffc7a1'},
- dark: {65: '#df843f', 80: '#ffb37e', 85: '#ffc7a1'},
+ dark: {25: '#503424', 65: '#df843f', 80: '#ffb37e'},
},
blue: {
light: {30: '#00458c', 50: '#0074e2', 80: '#a1caff', 85: '#b9d7ff'},
- dark: {65: '#5aa0f8', 75: '#88bcff', 80: '#a1caff', 85: '#b9d7ff'},
+ dark: {25: '#253c5a', 65: '#5aa0f8', 75: '#88bcff', 80: '#a1caff'},
},
red: {
- light: {30: '#8a0011', 35: '#9e0015', 55: '#de4745', 65: '#fa6762', 80: '#ffaea7', 85: '#ffc4be'},
- dark: {75: '#ff9890', 80: '#ffaea7', 85: '#ffc4be'},
+ light: {30: '#8a0011', 35: '#9e0015', 55: '#de4745', 65: '#fa6762', 70: '#ff7f77', 80: '#ffaea7', 85: '#ffc4be'},
+ dark: {25: '#5b2b28', 65: '#ee736c', 75: '#ff9890', 80: '#ffaea7', 85: '#ffc4be'},
},
yellow: {
light: {30: '#584400', 40: '#745b00', 65: '#c29900', 75: '#e2b623', 80: '#eec448', 85: '#f8d36a'},
- dark: {80: '#e3c36c', 90: '#fae19e'},
+ dark: {25: '#453a1c', 80: '#e3c36c', 90: '#fae19e'},
},
teal: {
light: {30: '#005348', 80: '#90d7c8', 85: '#a9e2d6'},
- dark: {65: '#4fb1a0', 75: '#81c9bb'},
+ dark: {25: '#28413c', 65: '#4fb1a0', 75: '#81c9bb'},
},
cyan: {
- dark: {65: '#49adc4', 75: '#71c7dd', 80: '#85d5e9', 85: '#9ae2f4'},
+ dark: {25: '#274046', 65: '#49adc4', 75: '#71c7dd', 80: '#85d5e9', 85: '#9ae2f4'},
light: {30: '#00505f'},
},
pink: {
light: {30: '#83004b', 70: '#fc78b1', 85: '#ffc0d7'},
- dark: {75: '#fd92bd', 85: '#ffc0d7'},
+ dark: {25: '#572b3d', 75: '#fd92bd', 80: '#ffa9ca'},
},
} as const;
diff --git a/packages/themes/neutral/src/neutralTheme.test.ts b/packages/themes/neutral/src/neutralTheme.test.ts
index 00f4450e1c..222df5be4e 100644
--- a/packages/themes/neutral/src/neutralTheme.test.ts
+++ b/packages/themes/neutral/src/neutralTheme.test.ts
@@ -66,7 +66,7 @@ describe('neutral theme palette mappings', () => {
),
'--color-background-red': lightDark(
neutralPalettes.red.light[85],
- `${neutralPalettes.red.dark[75]}3D`,
+ neutralPalettes.red.dark[25],
),
'--color-border-red': lightDark(
neutralPalettes.red.light[80],
@@ -78,11 +78,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-red': lightDark(
neutralPalettes.red.light[30],
- neutralPalettes.red.dark[85],
+ neutralPalettes.red.dark[80],
),
'--color-background-orange': lightDark(
neutralPalettes.orange.light[85],
- `${neutralPalettes.orange.light[75]}3D`,
+ neutralPalettes.orange.dark[25],
),
'--color-border-orange': lightDark(
neutralPalettes.orange.light[85],
@@ -94,11 +94,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-orange': lightDark(
neutralPalettes.orange.light[30],
- neutralPalettes.orange.dark[85],
+ neutralPalettes.orange.dark[80],
),
'--color-background-yellow': lightDark(
neutralPalettes.yellow.dark[90],
- `${neutralPalettes.yellow.light[75]}3D`,
+ neutralPalettes.yellow.dark[25],
),
'--color-border-yellow': lightDark(
neutralPalettes.yellow.dark[80],
@@ -110,11 +110,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-yellow': lightDark(
neutralPalettes.yellow.light[30],
- neutralPalettes.yellow.light[85],
+ neutralPalettes.yellow.light[80],
),
'--color-background-green': lightDark(
neutralPalettes.green.dark[85],
- `${neutralPalettes.green.light[75]}3D`,
+ neutralPalettes.green.dark[25],
),
'--color-border-green': lightDark(
neutralPalettes.green.dark[80],
@@ -126,11 +126,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-green': lightDark(
neutralPalettes.green.light[30],
- neutralPalettes.green.light[80],
+ neutralPalettes.green.light[75],
),
'--color-background-teal': lightDark(
neutralPalettes.teal.light[85],
- `${neutralPalettes.teal.dark[75]}3D`,
+ neutralPalettes.teal.dark[25],
),
'--color-border-teal': lightDark(
neutralPalettes.teal.light[80],
@@ -142,11 +142,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-teal': lightDark(
neutralPalettes.teal.light[30],
- neutralPalettes.teal.light[85],
+ neutralPalettes.teal.light[80],
),
'--color-background-cyan': lightDark(
neutralPalettes.cyan.dark[85],
- `${neutralPalettes.cyan.dark[75]}3D`,
+ neutralPalettes.cyan.dark[25],
),
'--color-border-cyan': lightDark(
neutralPalettes.cyan.dark[80],
@@ -158,11 +158,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-cyan': lightDark(
neutralPalettes.cyan.light[30],
- neutralPalettes.cyan.dark[85],
+ neutralPalettes.cyan.dark[80],
),
'--color-background-blue': lightDark(
neutralPalettes.blue.light[85],
- `${neutralPalettes.blue.dark[75]}3D`,
+ neutralPalettes.blue.dark[25],
),
'--color-border-blue': lightDark(
neutralPalettes.blue.light[80],
@@ -174,11 +174,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-blue': lightDark(
neutralPalettes.blue.light[30],
- neutralPalettes.blue.dark[85],
+ neutralPalettes.blue.dark[80],
),
'--color-background-purple': lightDark(
neutralPalettes.purple.light[90],
- `${neutralPalettes.purple.light[75]}3D`,
+ neutralPalettes.purple.dark[25],
),
'--color-border-purple': lightDark(
neutralPalettes.purple.light[85],
@@ -190,11 +190,11 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-purple': lightDark(
neutralPalettes.purple.light[30],
- neutralPalettes.purple.dark[85],
+ neutralPalettes.purple.dark[80],
),
'--color-background-pink': lightDark(
neutralPalettes.pink.light[85],
- `${neutralPalettes.pink.dark[75]}3D`,
+ neutralPalettes.pink.dark[25],
),
'--color-border-pink': lightDark(
neutralPalettes.pink.light[85],
@@ -206,12 +206,39 @@ describe('neutral theme palette mappings', () => {
),
'--color-text-pink': lightDark(
neutralPalettes.pink.light[30],
- neutralPalettes.pink.dark[85],
+ neutralPalettes.pink.dark[80],
+ ),
+ '--color-background-gray': lightDark(
+ neutralPalettes.neutral.light[90],
+ neutralPalettes.neutral.dark[20],
+ ),
+ '--color-text-gray': lightDark(
+ neutralPalettes.neutral.light[15],
+ neutralPalettes.neutral.dark[85],
),
};
expect(neutralTheme.tokens).toMatchObject(mappings);
});
+
+ it('keeps dark categorical text readable on its background', () => {
+ const pairs = [
+ [neutralPalettes.red.dark[80], neutralPalettes.red.dark[25]],
+ [neutralPalettes.orange.dark[80], neutralPalettes.orange.dark[25]],
+ [neutralPalettes.yellow.light[80], neutralPalettes.yellow.dark[25]],
+ [neutralPalettes.green.light[75], neutralPalettes.green.dark[25]],
+ [neutralPalettes.teal.light[80], neutralPalettes.teal.dark[25]],
+ [neutralPalettes.cyan.dark[80], neutralPalettes.cyan.dark[25]],
+ [neutralPalettes.blue.dark[80], neutralPalettes.blue.dark[25]],
+ [neutralPalettes.purple.dark[80], neutralPalettes.purple.dark[25]],
+ [neutralPalettes.pink.dark[80], neutralPalettes.pink.dark[25]],
+ [neutralPalettes.neutral.dark[85], neutralPalettes.neutral.dark[20]],
+ ] as const;
+
+ for (const [foreground, background] of pairs) {
+ expect(contrastRatio(foreground, background)).toBeGreaterThanOrEqual(4.5);
+ }
+ });
});
describe('neutral syntax contrast', () => {
@@ -271,6 +298,28 @@ describe('neutral theme-local status mappings', () => {
});
describe('neutral Banner tint mappings', () => {
+ it('uses a dedicated muted info surface without changing categorical blue', () => {
+ const mutedAccent = 'var(--astryx-theme-neutral-color-status-muted-accent)';
+ expect(neutralTheme.localTokens).toMatchObject({
+ '--astryx-theme-neutral-color-status-muted-accent': lightDark(
+ neutralPalettes.blue.light[85],
+ `${neutralPalettes.blue.dark[75]}3D`,
+ ),
+ });
+ expect(neutralTheme.components?.banner?.['status:info']).toMatchObject({
+ '--color-accent-muted': mutedAccent,
+ });
+ expect(neutralTheme.tokens['--color-background-blue']).toBe(
+ lightDark(neutralPalettes.blue.light[85], neutralPalettes.blue.dark[25]),
+ );
+ });
+
+ it('keeps the error background on the semantic muted token', () => {
+ expect(
+ neutralTheme.components?.banner?.['status:error'],
+ ).not.toHaveProperty('--color-error-muted');
+ });
+
it('uses light overlays in light mode and dark overlays in dark mode', () => {
expect(neutralTheme.localTokens).toMatchObject({
'--astryx-theme-neutral-color-on-tint-neutral':
@@ -290,6 +339,25 @@ describe('neutral Banner tint mappings', () => {
});
});
+describe('neutral destructive Button interaction treatment', () => {
+ it('uses component-scoped red palette overlays', () => {
+ expect(neutralTheme.localTokens).toMatchObject({
+ '--astryx-theme-neutral-color-destructive-overlay-hover':
+ 'light-dark(#ff7f770D, #ee736c0D)',
+ '--astryx-theme-neutral-color-destructive-overlay-pressed':
+ 'light-dark(#ff7f771A, #ee736c1A)',
+ });
+ expect(
+ neutralTheme.components?.button?.['variant:destructive'],
+ ).toMatchObject({
+ '--color-overlay-hover':
+ 'var(--astryx-theme-neutral-color-destructive-overlay-hover)',
+ '--color-overlay-pressed':
+ 'var(--astryx-theme-neutral-color-destructive-overlay-pressed)',
+ });
+ });
+});
+
describe('neutral theme component overrides', () => {
it('keeps the roomier segmented-control inset height-neutral', () => {
expect(neutralTheme.components?.['segmented-control']).toEqual({
diff --git a/packages/themes/neutral/src/neutralTheme.ts b/packages/themes/neutral/src/neutralTheme.ts
index 894d9d2f57..b84518b071 100644
--- a/packages/themes/neutral/src/neutralTheme.ts
+++ b/packages/themes/neutral/src/neutralTheme.ts
@@ -37,6 +37,10 @@ const neutralLocalTokens: Record<string, TokenValue> = {
'--astryx-theme-neutral-color-status-fill-success': ['#198100', '#64af4c'],
'--astryx-theme-neutral-color-status-fill-warning': '#ffce2f',
'--astryx-theme-neutral-color-status-fill-error': ['#c9303a', '#ff705d'],
+ '--astryx-theme-neutral-color-status-muted-accent': [
+ blue.light[85],
+ withAlpha(blue.dark[75], '3D'),
+ ],
'--astryx-theme-neutral-color-on-tint-neutral': ['#fafafa4D', '#0a0a0a4D'],
'--astryx-theme-neutral-color-on-tint-overlay-hover': [
'#fafafa1A',
@@ -46,6 +50,14 @@ const neutralLocalTokens: Record<string, TokenValue> = {
'#fafafa33',
'#0a0a0a33',
],
+ '--astryx-theme-neutral-color-destructive-overlay-hover': [
+ withAlpha(red.light[70], '0D'),
+ withAlpha(red.dark[65], '0D'),
+ ],
+ '--astryx-theme-neutral-color-destructive-overlay-pressed': [
+ withAlpha(red.light[70], '1A'),
+ withAlpha(red.dark[65], '1A'),
+ ],
};
const statusFill = {
@@ -160,67 +172,55 @@ export const neutralTheme = defineTheme({
],
'--color-tint-hover': ['black', 'white'],
- '--color-background-red': [red.light[85], withAlpha(red.dark[75], '3D')],
+ '--color-background-red': [red.light[85], red.dark[25]],
'--color-border-red': [red.light[80], red.light[65]],
'--color-icon-red': [red.light[30], red.dark[75]],
- '--color-text-red': [red.light[30], red.dark[85]],
+ '--color-text-red': [red.light[30], red.dark[80]],
- '--color-background-orange': [
- orange.light[85],
- withAlpha(orange.light[75], '3D'),
- ],
+ '--color-background-orange': [orange.light[85], orange.dark[25]],
'--color-border-orange': [orange.light[85], orange.dark[65]],
'--color-icon-orange': [orange.light[30], orange.light[75]],
- '--color-text-orange': [orange.light[30], orange.dark[85]],
+ '--color-text-orange': [orange.light[30], orange.dark[80]],
- '--color-background-yellow': [
- yellow.dark[90],
- withAlpha(yellow.light[75], '3D'),
- ],
+ '--color-background-yellow': [yellow.dark[90], yellow.dark[25]],
'--color-border-yellow': [yellow.dark[80], yellow.light[65]],
'--color-icon-yellow': [yellow.light[30], yellow.light[75]],
- '--color-text-yellow': [yellow.light[30], yellow.light[85]],
+ '--color-text-yellow': [yellow.light[30], yellow.light[80]],
- '--color-background-green': [
- green.dark[85],
- withAlpha(green.light[75], '3D'),
- ],
+ '--color-background-green': [green.dark[85], green.dark[25]],
'--color-border-green': [green.dark[80], green.light[65]],
'--color-icon-green': [green.light[30], green.light[75]],
- '--color-text-green': [green.light[30], green.light[80]],
+ '--color-text-green': [green.light[30], green.light[75]],
- '--color-background-teal': [teal.light[85], withAlpha(teal.dark[75], '3D')],
+ '--color-background-teal': [teal.light[85], teal.dark[25]],
'--color-border-teal': [teal.light[80], teal.dark[65]],
'--color-icon-teal': [teal.light[30], teal.dark[75]],
- '--color-text-teal': [teal.light[30], teal.light[85]],
+ '--color-text-teal': [teal.light[30], teal.light[80]],
- '--color-background-cyan': [cyan.dark[85], withAlpha(cyan.dark[75], '3D')],
+ '--color-background-cyan': [cyan.dark[85], cyan.dark[25]],
'--color-border-cyan': [cyan.dark[80], cyan.dark[65]],
'--color-icon-cyan': [cyan.light[30], cyan.dark[75]],
- '--color-text-cyan': [cyan.light[30], cyan.dark[85]],
+ '--color-text-cyan': [cyan.light[30], cyan.dark[80]],
- '--color-background-blue': [blue.light[85], withAlpha(blue.dark[75], '3D')],
+ '--color-background-blue': [blue.light[85], blue.dark[25]],
'--color-border-blue': [blue.light[80], blue.dark[65]],
'--color-icon-blue': [blue.light[30], blue.dark[75]],
- '--color-text-blue': [blue.light[30], blue.dark[85]],
+ '--color-text-blue': [blue.light[30], blue.dark[80]],
- '--color-background-purple': [
- purple.light[90],
- withAlpha(purple.light[75], '3D'),
- ],
+ '--color-background-purple': [purple.light[90], purple.dark[25]],
'--color-border-purple': [purple.light[85], purple.light[70]],
'--color-icon-purple': [purple.light[30], purple.light[75]],
- '--color-text-purple': [purple.light[30], purple.dark[85]],
+ '--color-text-purple': [purple.light[30], purple.dark[80]],
- '--color-background-pink': [pink.light[85], withAlpha(pink.dark[75], '3D')],
+ '--color-background-pink': [pink.light[85], pink.dark[25]],
'--color-border-pink': [pink.light[85], pink.light[70]],
'--color-icon-pink': [pink.light[30], pink.dark[75]],
- '--color-text-pink': [pink.light[30], pink.dark[85]],
+ '--color-text-pink': [pink.light[30], pink.dark[80]],
- '--color-background-gray': [neutral.light[90], 'var(--color-neutral)'],
+ '--color-background-gray': [neutral.light[90], neutral.dark[20]],
'--color-border-gray': [neutral.light[85], neutral.dark[15]],
'--color-icon-gray': [neutral.light[35], neutral.dark[65]],
- '--color-text-gray': [neutral.light[15], neutral.dark[90]],
+ '--color-text-gray': [neutral.light[15], neutral.dark[85]],
// =========================================================================
// Radius — slightly larger than default (kept as-is)
@@ -277,6 +277,10 @@ export const neutralTheme = defineTheme({
'variant:destructive': {
backgroundColor: 'var(--color-error-muted)',
color: 'var(--color-error)',
+ '--color-overlay-hover':
+ 'var(--astryx-theme-neutral-color-destructive-overlay-hover)',
+ '--color-overlay-pressed':
+ 'var(--astryx-theme-neutral-color-destructive-overlay-pressed)',
},
},
@@ -387,7 +391,8 @@ export const neutralTheme = defineTheme({
'var(--astryx-theme-neutral-color-on-tint-overlay-pressed)',
},
'status:info': {
- '--color-accent-muted': 'var(--color-background-blue)',
+ '--color-accent-muted':
+ 'var(--astryx-theme-neutral-color-status-muted-accent)',
'--color-text-primary': 'var(--color-text-blue)',
'--color-text-secondary': 'var(--color-text-blue)',
'--color-accent': 'var(--color-text-blue)',
@@ -403,7 +408,6 @@ export const neutralTheme = defineTheme({
'--color-warning': 'var(--color-text-yellow)',
},
'status:error': {
- '--color-error-muted': 'var(--color-background-red)',
'--color-text-primary': 'var(--color-text-red)',
'--color-text-secondary': 'var(--color-text-red)',
'--color-error': 'var(--color-text-red)',