Skip to content

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

TypeScript

feat(core): rename Text 'active' color to 'accent' mapped to --color-text-accent (#3230)

Cindy Zhang7386d171aa9e
diff --git a/.changeset/text-accent-color.md b/.changeset/text-accent-color.md
new file mode 100644
index 0000000000..726c9b8907
--- /dev/null
+++ b/.changeset/text-accent-color.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+'@astryxdesign/cli': patch
+---
+
+[breaking] `Text`, `Heading`, `Link`, and `Timestamp` rename the `color="active"` value to `color="accent"`, now mapping to the dedicated `--color-text-accent` token (legible accent text ink) instead of `--color-accent`. Run `astryx upgrade` to migrate call sites automatically. (#2863)
+@cixzhang
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx
index 6f935b450e..725a031c2b 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx
@@ -461,10 +461,7 @@ export default function ExampleCardsPage() {
value="bank"
label="Bank Transfer — SWIFT / IBAN"
/>
- <RadioListItem
- value="paypal"
- label="PayPal — Instant Payout"
- />
+ <RadioListItem value="paypal" label="PayPal — Instant Payout" />
</RadioList>
<TextInput
label="IBAN / Account Number"
@@ -747,7 +744,7 @@ export default function ExampleCardsPage() {
<Text type="supporting" color="secondary">
Solar Gen
</Text>
- <Text type="label" weight="bold" color="active">
+ <Text type="label" weight="bold" color="accent">
+1.2 kW
</Text>
</VStack>
@@ -1136,9 +1133,7 @@ export default function ExampleCardsPage() {
QR Code
</Text>
</div>
- <Heading level={3}>
- Scan to connect your mobile device
- </Heading>
+ <Heading level={3}>Scan to connect your mobile device</Heading>
<Text type="supporting" color="secondary">
Open the Ledger mobile app and scan this code to link your
device.
@@ -1751,11 +1746,7 @@ export default function ExampleCardsPage() {
<Button label="Small" variant="secondary" size="sm" />
<Button label="Medium" variant="secondary" size="md" />
<Button label="Large" variant="secondary" size="lg" />
- <Button
- label="Disabled"
- variant="secondary"
- isDisabled
- />
+ <Button label="Disabled" variant="secondary" isDisabled />
</HStack>
</VStack>
<VStack gap={1}>
@@ -1766,11 +1757,7 @@ export default function ExampleCardsPage() {
<Button label="Small" variant="destructive" size="sm" />
<Button label="Medium" variant="destructive" size="md" />
<Button label="Large" variant="destructive" size="lg" />
- <Button
- label="Disabled"
- variant="destructive"
- isDisabled
- />
+ <Button label="Disabled" variant="destructive" isDisabled />
</HStack>
</VStack>
<VStack gap={1}>
@@ -2038,9 +2025,7 @@ export default function ExampleCardsPage() {
<Text type="supporting" color="secondary">
Code
</Text>
- <Text type="code">
- const fox = &apos;quick brown&apos;;
- </Text>
+ <Text type="code">const fox = &apos;quick brown&apos;;</Text>
</VStack>
</VStack>
</VStack>
diff --git a/apps/storybook/stories/Heading.stories.tsx b/apps/storybook/stories/Heading.stories.tsx
index cb1c3570b2..5c6982ad5b 100644
--- a/apps/storybook/stories/Heading.stories.tsx
+++ b/apps/storybook/stories/Heading.stories.tsx
@@ -21,7 +21,7 @@ const meta: Meta<typeof Heading> = {
'secondary',
'disabled',
'placeholder',
- 'active',
+ 'accent',
'inherit',
],
description: 'Text color',
@@ -158,7 +158,7 @@ export const ColorVariants: Story = {
<Heading level={2} color="placeholder">
Placeholder heading
</Heading>
- <Heading level={2} color="active">
+ <Heading level={2} color="accent">
Active heading (accent)
</Heading>
<div style={{color: 'purple'}}>
diff --git a/apps/storybook/stories/Link.stories.tsx b/apps/storybook/stories/Link.stories.tsx
index 8dc792b734..e63e13840b 100644
--- a/apps/storybook/stories/Link.stories.tsx
+++ b/apps/storybook/stories/Link.stories.tsx
@@ -20,7 +20,7 @@ const meta: Meta<typeof Link> = {
color: {
control: 'select',
options: [
- 'active',
+ 'accent',
'primary',
'secondary',
'disabled',
@@ -129,8 +129,8 @@ export const Standalone: Story = {
export const InlineWithText: Story = {
render: () => (
<Text type="body">
- Read the <Link href="/docs">documentation</Link> for more
- information about using Astryx components.
+ Read the <Link href="/docs">documentation</Link> for more information
+ about using Astryx components.
</Text>
),
};
@@ -195,11 +195,7 @@ export const ExternalLinks: Story = {
<Link href="https://developer.mozilla.org" isExternalLink isStandalone>
MDN Web Docs
</Link>
- <Link
- href="https://react.dev"
- isExternalLink
- hasUnderline
- isStandalone>
+ <Link href="https://react.dev" isExternalLink hasUnderline isStandalone>
React Documentation
</Link>
</div>
@@ -215,10 +211,7 @@ export const LinksWithTooltips: Story = {
isStandalone>
Settings
</Link>
- <Link
- href="/profile"
- tooltip="View and edit your profile"
- isStandalone>
+ <Link href="/profile" tooltip="View and edit your profile" isStandalone>
Profile
</Link>
<Link
@@ -313,8 +306,8 @@ export const ButtonFallbackVariants: Story = {
export const ButtonFallbackInline: Story = {
render: () => (
<Text type="body">
- You can <Link onClick={() => alert('Undo!')}>undo this action</Link>{' '}
- if you change your mind.
+ You can <Link onClick={() => alert('Undo!')}>undo this action</Link> if
+ you change your mind.
</Text>
),
parameters: {
diff --git a/apps/storybook/stories/Text.stories.tsx b/apps/storybook/stories/Text.stories.tsx
index c51b32d18d..544051c771 100644
--- a/apps/storybook/stories/Text.stories.tsx
+++ b/apps/storybook/stories/Text.stories.tsx
@@ -37,7 +37,7 @@ const meta: Meta<typeof Text> = {
'secondary',
'disabled',
'placeholder',
- 'active',
+ 'accent',
'inherit',
],
description: 'Text color',
@@ -139,9 +139,7 @@ export const AllTypes: Story = {
<Text type="body">Body: The bulk of content (14px)</Text>
<Text type="large">Large: Emphasized content (16px)</Text>
<Text type="label">Label: Form/chart labels (14px medium)</Text>
- <Text type="supporting">
- Supporting: Helper text (12px secondary)
- </Text>
+ <Text type="supporting">Supporting: Helper text (12px secondary)</Text>
<Text type="code">Code: const x = 1; (14px monospace)</Text>
</div>
),
@@ -166,7 +164,7 @@ export const ColorVariants: Story = {
<Text type="body" color="placeholder">
Placeholder color
</Text>
- <Text type="body" color="active">
+ <Text type="body" color="accent">
Active color (accent)
</Text>
<div style={{color: 'purple'}}>
@@ -628,7 +626,7 @@ export const MetricsExample: Story = {
<Text type="body" color="secondary" display="block">
Conversion
</Text>
- <Text type="large" weight="bold" color="active" hasTabularNumbers>
+ <Text type="large" weight="bold" color="accent" hasTabularNumbers>
23.4%
</Text>
</div>
@@ -669,7 +667,7 @@ export const FormLikeContext: Story = {
These text types create a natural visual hierarchy without any
additional styling.
</Text>
- <Text type="supporting" color="active" display="block">
+ <Text type="supporting" color="accent" display="block">
Active supporting text draws attention to important details.
</Text>
</div>
diff --git a/apps/storybook/stories/Timestamp.stories.tsx b/apps/storybook/stories/Timestamp.stories.tsx
index 2ca4433c31..b2fda36cbd 100644
--- a/apps/storybook/stories/Timestamp.stories.tsx
+++ b/apps/storybook/stories/Timestamp.stories.tsx
@@ -61,7 +61,7 @@ const meta: Meta<typeof Timestamp> = {
'secondary',
'disabled',
'placeholder',
- 'active',
+ 'accent',
'inherit',
],
description: 'Text color',
@@ -249,16 +249,8 @@ export const TextTypes: Story = {
format="date_time"
type="supporting"
/>
- <Timestamp
- value="2026-02-19T17:00:00Z"
- format="date_time"
- type="body"
- />
- <Timestamp
- value="2026-02-19T17:00:00Z"
- format="date_time"
- type="large"
- />
+ <Timestamp value="2026-02-19T17:00:00Z" format="date_time" type="body" />
+ <Timestamp value="2026-02-19T17:00:00Z" format="date_time" type="large" />
<Timestamp
value="2026-02-19T17:00:00Z"
format="date_time"
@@ -290,7 +282,7 @@ export const Colors: Story = {
<Timestamp
value="2026-02-19T17:00:00Z"
format="date_time"
- color="active"
+ color="accent"
/>
</div>
),
diff --git a/packages/cli/src/codemods/__tests__/registry.test.mjs b/packages/cli/src/codemods/__tests__/registry.test.mjs
index a343efb523..817d9c09a7 100644
--- a/packages/cli/src/codemods/__tests__/registry.test.mjs
+++ b/packages/cli/src/codemods/__tests__/registry.test.mjs
@@ -17,6 +17,7 @@ describe('registry', () => {
'0.0.14',
'0.0.15',
'0.1.0',
+ '0.1.2',
]);
});
});
diff --git a/packages/cli/src/codemods/registry.mjs b/packages/cli/src/codemods/registry.mjs
index 1a142dc0c0..0648686c28 100644
--- a/packages/cli/src/codemods/registry.mjs
+++ b/packages/cli/src/codemods/registry.mjs
@@ -18,6 +18,7 @@ const registry = new Map([
['0.0.14', () => import('./transforms/v0.0.14/index.mjs')],
['0.0.15', () => import('./transforms/v0.0.15/index.mjs')],
['0.1.0', () => import('./transforms/v0.1.0/index.mjs')],
+ ['0.1.2', () => import('./transforms/v0.1.2/index.mjs')],
]);
// Re-export from the shared utility so registry callers and other consumers
diff --git a/packages/cli/src/codemods/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs b/packages/cli/src/codemods/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs
new file mode 100644
index 0000000000..b1c0b70a53
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs
@@ -0,0 +1,120 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+import {describe, it, expect} from 'vitest';
+
+async function applyTransform(source) {
+ const {default: transform} =
+ await import('../rename-text-color-active-to-accent.mjs');
+ const jscodeshift = (await import('jscodeshift')).default;
+ const j = jscodeshift.withParser('tsx');
+ const api = {jscodeshift: j, stats: () => {}, report: () => {}};
+ const file = {source, path: 'test.tsx'};
+ const result = transform(file, api);
+ return result ?? source;
+}
+
+describe('rename-text-color-active-to-accent', () => {
+ it('renames Text color="active" to color="accent"', async () => {
+ const input = `<Text color="active">Hi</Text>`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain('active');
+ });
+
+ it('renames Heading color="active" to color="accent"', async () => {
+ const input = `<Heading level={2} color="active">Title</Heading>`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain('active');
+ });
+
+ it('renames Link color="active" to color="accent"', async () => {
+ const input = `<Link href="/x" color="active">Go</Link>`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain('active');
+ });
+
+ it('renames Timestamp color="active" to color="accent"', async () => {
+ const input = `<Timestamp value={d} color="active" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain('active');
+ });
+
+ it("renames expression-container color={'active'}", async () => {
+ const input = `<Text color={'active'}>Hi</Text>`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain("'active'");
+ });
+
+ it('renames active inside a ternary color expression', async () => {
+ const input = `<Text color={isOn ? 'active' : 'secondary'}>Hi</Text>`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).toContain("'secondary'");
+ expect(output).not.toContain("'active'");
+ });
+
+ it('does not change other color values', async () => {
+ const input = `<Text color="secondary">Hi</Text>`;
+ const output = await applyTransform(input);
+ expect(output).toBe(input);
+ });
+
+ it('does not touch color="active" on non-target components', async () => {
+ const input = `<StatusDot color="active" />`;
+ const output = await applyTransform(input);
+ expect(output).toBe(input);
+ });
+
+ it('does not touch unrelated "active" string literals', async () => {
+ const input = `const node = {id: 'active', label: 'Active Users'};`;
+ const output = await applyTransform(input);
+ expect(output).toBe(input);
+ });
+
+ it('does not touch a status enum value named active', async () => {
+ const input = `const filters = {status: 'active'};`;
+ const output = await applyTransform(input);
+ expect(output).toBe(input);
+ });
+
+ it('renames object color prop in files importing a target component', async () => {
+ const input = `import {Text} from '@xds/core/Text';
+const cfg = {color: 'active'};`;
+ const output = await applyTransform(input);
+ expect(output).toContain("color: 'accent'");
+ expect(output).not.toContain("'active'");
+ });
+
+ it("renames color: 'active' as const in files importing a target component", async () => {
+ const input = `import {Text} from '@xds/core/Text';
+const COLORS = [{color: 'active' as const, description: 'Accent'}];`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent' as const");
+ expect(output).not.toContain("'active'");
+ });
+
+ it('does not rename object color prop when no target component is imported', async () => {
+ const input = `const cfg = {color: 'active'};`;
+ const output = await applyTransform(input);
+ expect(output).toBe(input);
+ });
+
+ it('renames active in Storybook color argTypes options', async () => {
+ const input = `import {Text} from '@xds/core/Text';
+const meta = {argTypes: {color: {control: 'select', options: ['primary', 'active', 'inherit']}}};`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain("'active'");
+ });
+
+ it('returns undefined (no change) when nothing matches', async () => {
+ const input = `<Text color="primary">Hi</Text>`;
+ const output = await applyTransform(input);
+ // applyTransform falls back to source when transform returns undefined
+ expect(output).toBe(input);
+ });
+});
diff --git a/packages/cli/src/codemods/transforms/v0.1.2/index.mjs b/packages/cli/src/codemods/transforms/v0.1.2/index.mjs
new file mode 100644
index 0000000000..38c6da5f8a
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.1.2/index.mjs
@@ -0,0 +1,19 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file v0.1.2 transform manifest
+ *
+ * Lists all codemods for the v0.1.2 release in the order they should run.
+ */
+
+import renameTextColorActiveToAccent, {
+ meta as renameTextColorActiveToAccentMeta,
+} from './rename-text-color-active-to-accent.mjs';
+
+export default [
+ {
+ name: 'rename-text-color-active-to-accent',
+ transform: renameTextColorActiveToAccent,
+ meta: renameTextColorActiveToAccentMeta,
+ },
+];
diff --git a/packages/cli/src/codemods/transforms/v0.1.2/rename-text-color-active-to-accent.mjs b/packages/cli/src/codemods/transforms/v0.1.2/rename-text-color-active-to-accent.mjs
new file mode 100644
index 0000000000..b75cc014c2
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.1.2/rename-text-color-active-to-accent.mjs
@@ -0,0 +1,136 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file Codemod: Rename Text/Heading/Link/Timestamp color "active" to "accent"
+ * @see https://github.com/facebook/astryx/issues/2863
+ *
+ * The `active` text-color value is renamed to `accent` and now maps to the
+ * dedicated `--color-text-accent` token (legible accent ink) instead of
+ * `--color-accent` (the interactive/base accent surface). This gives a
+ * first-class, type-safe way to render accent-colored text and resolves the
+ * gap reported in #2863.
+ *
+ * Transforms (scoped to Text, Heading, Link, and Timestamp):
+ * - <Text color="active" /> → <Text color="accent" />
+ * - <Heading color={'active'} /> → <Heading color={'accent'} />
+ * - <Text color={cond ? 'active' : x}> → <Text color={cond ? 'accent' : x}>
+ * - Storybook argTypes: color: { options: [..., 'active', ...] }
+ * → replaces 'active' with 'accent' (files importing a target component)
+ * - Object properties: { color: 'active' } / { color: 'active' as const }
+ * → { color: 'accent' } (files importing a target component)
+ *
+ * The transform deliberately does NOT touch bare `'active'` strings that are
+ * not a `color` value (e.g. status enums, ids, filter values), so it is safe
+ * to run across an entire codebase.
+ */
+
+export const meta = {
+ title: 'Rename Text/Heading/Link/Timestamp color "active" to "accent"',
+ description:
+ 'Renames the `color="active"` value to `color="accent"` on Text, Heading, ' +
+ 'Link, and Timestamp. The `accent` value maps to `--color-text-accent` ' +
+ '(the dedicated accent text ink). Also updates Storybook color argTypes ' +
+ 'options and object-literal `color` props in files that import a target component.',
+ pr: '#2863',
+};
+
+const OLD_VALUE = 'active';
+const NEW_VALUE = 'accent';
+
+/** Components whose `color` prop accepts a TextColor value. */
+const TARGET_COMPONENTS = new Set(['Text', 'Heading', 'Link', 'Timestamp']);
+
+export default function transformer(file, api) {
+ const j = api.jscodeshift;
+ const root = j(file.source);
+ let hasChanges = false;
+
+ /** Rewrite a string-literal node when it equals the old value. */
+ function renameStringLiteral(node) {
+ if (!node) return false;
+ if (
+ (node.type === 'StringLiteral' || node.type === 'Literal') &&
+ node.value === OLD_VALUE
+ ) {
+ node.value = NEW_VALUE;
+ if (node.raw) node.raw = `'${NEW_VALUE}'`;
+ return true;
+ }
+ return false;
+ }
+
+ /** Recursively rewrite the old value inside ternary/logical expressions. */
+ function renameInExpression(node) {
+ if (!node) return false;
+ let changed = false;
+ if (node.type === 'StringLiteral' || node.type === 'Literal') {
+ changed = renameStringLiteral(node) || changed;
+ } else if (node.type === 'ConditionalExpression') {
+ changed = renameInExpression(node.consequent) || changed;
+ changed = renameInExpression(node.alternate) || changed;
+ } else if (node.type === 'LogicalExpression') {
+ changed = renameInExpression(node.left) || changed;
+ changed = renameInExpression(node.right) || changed;
+ } else if (node.type === 'TSAsExpression') {
+ // `'active' as const` → rewrite the inner expression
+ changed = renameInExpression(node.expression) || changed;
+ }
+ return changed;
+ }
+
+ // --- 1. JSX attribute: color="active" / color={'active'} on target components ---
+ root.find(j.JSXOpeningElement).forEach(path => {
+ const name = path.node.name;
+ const componentName = name.type === 'JSXIdentifier' ? name.name : null;
+ if (!componentName || !TARGET_COMPONENTS.has(componentName)) return;
+
+ path.node.attributes.forEach(attr => {
+ if (attr.type !== 'JSXAttribute') return;
+ if (!attr.name || attr.name.name !== 'color') return;
+
+ const value = attr.value;
+ if (!value) return;
+
+ if (value.type === 'StringLiteral' || value.type === 'Literal') {
+ if (renameStringLiteral(value)) hasChanges = true;
+ } else if (value.type === 'JSXExpressionContainer') {
+ if (renameInExpression(value.expression)) hasChanges = true;
+ }
+ });
+ });
+
+ // Object-property / argTypes transforms only run in files that use a target
+ // component — keeps unrelated `{ color: 'active' }` / `'active'` strings safe.
+ const importsTarget =
+ root
+ .find(j.ImportSpecifier)
+ .filter(p => TARGET_COMPONENTS.has(p.node.imported?.name))
+ .size() > 0;
+
+ if (importsTarget) {
+ const PropertyType = j.ObjectProperty ?? j.Property;
+
+ // --- 2. Object property: { color: 'active' } / { color: 'active' as const } ---
+ root.find(PropertyType, {key: {name: 'color'}}).forEach(path => {
+ if (renameInExpression(path.node.value)) hasChanges = true;
+ });
+
+ // --- 3. Storybook argTypes: color: { options: [..., 'active', ...] } ---
+ root.find(PropertyType, {key: {name: 'color'}}).forEach(path => {
+ const value = path.node.value;
+ if (!value || value.type !== 'ObjectExpression') return;
+
+ const optionsProp = value.properties.find(
+ p => p.key && (p.key.name === 'options' || p.key.value === 'options'),
+ );
+ if (optionsProp && optionsProp.value.type === 'ArrayExpression') {
+ optionsProp.value.elements.forEach(el => {
+ if (renameStringLiteral(el)) hasChanges = true;
+ });
+ }
+ });
+ }
+
+ if (!hasChanges) return undefined;
+ return root.toSource({quote: 'single'});
+}
diff --git a/packages/cli/templates/blocks/components/ChatDictationButton/ChatDictationButtonShowcase.tsx b/packages/cli/templates/blocks/components/ChatDictationButton/ChatDictationButtonShowcase.tsx
index e814ec1ca4..8007344f58 100644
--- a/packages/cli/templates/blocks/components/ChatDictationButton/ChatDictationButtonShowcase.tsx
+++ b/packages/cli/templates/blocks/components/ChatDictationButton/ChatDictationButtonShowcase.tsx
@@ -19,7 +19,7 @@ export default function ChatDictationButtonShowcase() {
const dictation = useChatDictation({
inputRef,
hasSounds: true,
- onResult: (text) => {
+ onResult: text => {
console.log('Dictation result:', text);
},
});
@@ -31,7 +31,7 @@ export default function ChatDictationButtonShowcase() {
input.
</Text>
<ChatComposer
- onSubmit={(v) => console.log('Submit:', v)}
+ onSubmit={v => console.log('Submit:', v)}
input={<ChatComposerInput handleRef={inputRef} />}
sendActions={<ChatDictationButton dictation={dictation} />}
/>
@@ -63,7 +63,7 @@ export default function ChatDictationButtonShowcase() {
</HStack>
)}
{!dictation.isSupported && (
- <Text type="supporting" color="active">
+ <Text type="supporting" color="accent">
SpeechRecognition is not supported in this browser.
</Text>
)}
diff --git a/packages/cli/templates/blocks/components/Text/TextColors.tsx b/packages/cli/templates/blocks/components/Text/TextColors.tsx
index 5add436691..b048af5742 100644
--- a/packages/cli/templates/blocks/components/Text/TextColors.tsx
+++ b/packages/cli/templates/blocks/components/Text/TextColors.tsx
@@ -6,11 +6,26 @@ import {Text} from '@astryxdesign/core/Text';
import {Stack} from '@astryxdesign/core/Stack';
const COLORS = [
- {color: 'primary' as const, description: 'Primary — Default for headings and body text'},
- {color: 'secondary' as const, description: 'Secondary — Supporting details and metadata'},
- {color: 'active' as const, description: 'Active — Links, success states, and emphasis'},
- {color: 'disabled' as const, description: 'Disabled — Unavailable or inactive content'},
- {color: 'placeholder' as const, description: 'Placeholder — Empty field hints'},
+ {
+ color: 'primary' as const,
+ description: 'Primary — Default for headings and body text',
+ },
+ {
+ color: 'secondary' as const,
+ description: 'Secondary — Supporting details and metadata',
+ },
+ {
+ color: 'accent' as const,
+ description: 'Accent — Links, emphasis, and accent-colored text',
+ },
+ {
+ color: 'disabled' as const,
+ description: 'Disabled — Unavailable or inactive content',
+ },
+ {
+ color: 'placeholder' as const,
+ description: 'Placeholder — Empty field hints',
+ },
];
export default function TextColors() {
diff --git a/packages/cli/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx b/packages/cli/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx
index 16b118acac..fd1e62b718 100644
--- a/packages/cli/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx
+++ b/packages/cli/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx
@@ -8,10 +8,30 @@ import {Stack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';
const ATTACHMENTS = [
- {id: 1, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-1.png', alt: 'River through a valley', label: 'valley.jpg'},
- {id: 2, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-2.png', alt: 'Foggy mountain peak', label: 'mountain.jpg'},
- {id: 3, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-3.png', alt: 'Golden retriever puppy', label: 'puppy.jpg'},
- {id: 4, src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-4.png', alt: 'Bridge at sunset', label: 'bridge.jpg'},
+ {
+ id: 1,
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-1.png',
+ alt: 'River through a valley',
+ label: 'valley.jpg',
+ },
+ {
+ id: 2,
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-2.png',
+ alt: 'Foggy mountain peak',
+ label: 'mountain.jpg',
+ },
+ {
+ id: 3,
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-3.png',
+ alt: 'Golden retriever puppy',
+ label: 'puppy.jpg',
+ },
+ {
+ id: 4,
+ src: 'https://lookaside.facebook.com/assets/astryx/illustrative-vertical-4.png',
+ alt: 'Bridge at sunset',
+ label: 'bridge.jpg',
+ },
];
export default function ThumbnailGallery() {
@@ -38,7 +58,7 @@ export default function ThumbnailGallery() {
))}
</Stack>
{selected != null && (
- <Text type="supporting" color="active">
+ <Text type="supporting" color="accent">
Previewing: {selected}
</Text>
)}
diff --git a/packages/cli/templates/blocks/components/Timestamp/TimestampColors.tsx b/packages/cli/templates/blocks/components/Timestamp/TimestampColors.tsx
index 1ef6200f4f..299f6ccdf9 100644
--- a/packages/cli/templates/blocks/components/Timestamp/TimestampColors.tsx
+++ b/packages/cli/templates/blocks/components/Timestamp/TimestampColors.tsx
@@ -31,9 +31,9 @@ export default function TimestampColors() {
</Stack>
<Stack direction="vertical" gap={1}>
<Text type="supporting" color="secondary">
- Active
+ Accent
</Text>
- <Timestamp value={DATE} format="date_time" color="active" />
+ <Timestamp value={DATE} format="date_time" color="accent" />
</Stack>
</Stack>
);
diff --git a/packages/cli/templates/pages/theme-showcase/page.tsx b/packages/cli/templates/pages/theme-showcase/page.tsx
index 9e64b077ac..8a27a6d9e5 100644
--- a/packages/cli/templates/pages/theme-showcase/page.tsx
+++ b/packages/cli/templates/pages/theme-showcase/page.tsx
@@ -143,12 +143,6 @@ const styles: Record<string, CSSProperties> = {
textAlign: 'center' as const,
maxWidth: 560,
},
- // Hero headline painted with the theme's accent-text ink. Text has no
- // 'accent' color value, so we set the dedicated --color-text-accent token
- // directly (distinct from --color-accent / the 'active' color).
- heroHeadline: {
- color: 'var(--color-text-accent)',
- },
centerText: {
textAlign: 'center',
},
@@ -438,7 +432,7 @@ function StorePreview({
<VStack gap={10} style={{...styles.content, ...styles.contentFluid}}>
<Center>
<VStack gap={4} hAlign="center" style={styles.heroText}>
- <Text type="display-2" style={styles.heroHeadline}>
+ <Text type="display-2" color="accent">
Little joys,
<br />
everywhere you go
@@ -462,10 +456,7 @@ function StorePreview({
/>
</AspectRatio>
<div style={inlineStyles.cardBody}>
- <VStack
- gap={2}
- hAlign="center"
- style={styles.cardStack}>
+ <VStack gap={2} hAlign="center" style={styles.cardStack}>
<HStack>
<Badge label={p.badge} variant={p.badgeVariant} />
</HStack>
@@ -475,7 +466,10 @@ function StorePreview({
<Text
type="supporting"
color="secondary"
- style={{...styles.cardDescription, ...styles.centerText}}>
+ style={{
+ ...styles.cardDescription,
+ ...styles.centerText,
+ }}>
{p.description}
</Text>
<HStack gap={2} vAlign="center" hAlign="center">
@@ -746,9 +740,7 @@ function ChatCard() {
<ChatMessage sender="assistant">
<VStack gap={3}>
- <Text type="body">
- Here’s everything I have on order #1043:
- </Text>
+ <Text type="body">Here’s everything I have on order #1043:</Text>
<Card padding={3}>
<VStack gap={1}>
<Item
@@ -1107,10 +1099,7 @@ function InventoryCard({
).length;
return (
<Card padding={0} style={styles.inventoryCard}>
- <HStack
- hAlign="between"
- vAlign="center"
- style={styles.inventoryHeader}>
+ <HStack hAlign="between" vAlign="center" style={styles.inventoryHeader}>
<Heading level={2}>Inventory</Heading>
<Button
label="Add item"
diff --git a/packages/core/src/Link/Link.test.tsx b/packages/core/src/Link/Link.test.tsx
index 08570fd06c..f6e5ddb698 100644
--- a/packages/core/src/Link/Link.test.tsx
+++ b/packages/core/src/Link/Link.test.tsx
@@ -99,8 +99,8 @@ describe('Link', () => {
it('renders with different color values', () => {
const {rerender} = render(
- <Link href="/test" color="active">
- Active
+ <Link href="/test" color="accent">
+ Accent
</Link>,
);
expect(screen.getByRole('link')).toBeInTheDocument();
diff --git a/packages/core/src/Link/Link.tsx b/packages/core/src/Link/Link.tsx
index 5c2180681f..1938921cc6 100644
--- a/packages/core/src/Link/Link.tsx
+++ b/packages/core/src/Link/Link.tsx
@@ -117,7 +117,7 @@ const linkColorStyles = stylex.create({
placeholder: {
color: colorVars['--color-text-secondary'],
},
- active: {
+ accent: {
color: colorVars['--color-text-accent'],
},
inherit: {
@@ -216,7 +216,7 @@ export interface LinkProps extends BaseProps<
weight?: TextWeight;
/**
* Text color. Forwarded to Text.
- * @default 'active'
+ * @default 'accent'
*/
color?: TextColor;
/**
@@ -264,7 +264,7 @@ export function Link({
type = 'body',
size,
weight,
- color = 'active',
+ color = 'accent',
display = 'inline',
maxLines = 0,
children,
diff --git a/packages/core/src/Text/Heading.doc.mjs b/packages/core/src/Text/Heading.doc.mjs
index afe508d2d2..da4923d5c2 100644
--- a/packages/core/src/Text/Heading.doc.mjs
+++ b/packages/core/src/Text/Heading.doc.mjs
@@ -32,7 +32,7 @@ export const docs = {
},
{
name: 'color',
- type: "'primary' | 'secondary' | 'disabled' | 'placeholder' | 'active' | 'inherit'",
+ type: "'primary' | 'secondary' | 'disabled' | 'placeholder' | 'accent' | 'inherit'",
description: 'Text color.',
default: "'primary'",
},
@@ -119,7 +119,7 @@ export const docsZh = {
},
{
name: 'color',
- type: "'primary' | 'secondary' | 'disabled' | 'placeholder' | 'active' | 'inherit'",
+ type: "'primary' | 'secondary' | 'disabled' | 'placeholder' | 'accent' | 'inherit'",
description: '文本颜色。',
default: "'primary'",
},
diff --git a/packages/core/src/Text/Text.doc.mjs b/packages/core/src/Text/Text.doc.mjs
index 61149bb4e3..09d2c238ae 100644
--- a/packages/core/src/Text/Text.doc.mjs
+++ b/packages/core/src/Text/Text.doc.mjs
@@ -40,7 +40,7 @@ export const docs = {
},
{
name: 'color',
- type: "'primary' | 'secondary' | 'disabled' | 'placeholder' | 'active' | 'inherit'",
+ type: "'primary' | 'secondary' | 'disabled' | 'placeholder' | 'accent' | 'inherit'",
description: "Text color. Defaults to 'secondary' for the 'supporting' type, 'primary' for all others.",
},
{
diff --git a/packages/core/src/Text/text.stylex.ts b/packages/core/src/Text/text.stylex.ts
index 97726fbcdd..d612e49ca0 100644
--- a/packages/core/src/Text/text.stylex.ts
+++ b/packages/core/src/Text/text.stylex.ts
@@ -35,8 +35,8 @@ export const colorStyles = stylex.create({
placeholder: {
color: colorVars['--color-text-secondary'],
},
- active: {
- color: colorVars['--color-accent'],
+ accent: {
+ color: colorVars['--color-text-accent'],
},
inherit: {
color: 'inherit',
diff --git a/packages/core/src/theme/generateThemeRules.test.ts b/packages/core/src/theme/generateThemeRules.test.ts
index 6201bba50a..4ea4955f30 100644
--- a/packages/core/src/theme/generateThemeRules.test.ts
+++ b/packages/core/src/theme/generateThemeRules.test.ts
@@ -101,7 +101,9 @@ describe('generateThemeRules', () => {
it('includes .astryx-heading.level-* rules for all 6 levels', () => {
for (let level = 1; level <= 6; level++) {
- const rule = rules.find(r => r.includes(`.astryx-heading.level-${level}`));
+ const rule = rules.find(r =>
+ r.includes(`.astryx-heading.level-${level}`),
+ );
expect(rule).toBeDefined();
expect(rule).toContain('font-family');
expect(rule).toContain(`var(--text-heading-${level}-size)`);
@@ -137,9 +139,7 @@ describe('generateThemeRules', () => {
});
const pseudoRules = generateThemeRules(pseudoTheme);
expect(
- pseudoRules.some(rule =>
- rule.includes('.astryx-button:hover'),
- ),
+ pseudoRules.some(rule => rule.includes('.astryx-button:hover')),
).toBe(true);
});
@@ -186,7 +186,8 @@ describe('generateThemeRules', () => {
expect(rules.some(r => r.includes('.astryx-text.secondary'))).toBe(true);
expect(rules.some(r => r.includes('.astryx-heading.primary'))).toBe(true);
expect(rules.some(r => r.includes('.astryx-heading.disabled'))).toBe(true);
- expect(rules.some(r => r.includes('.astryx-text.active'))).toBe(true);
+ expect(rules.some(r => r.includes('.astryx-text.active'))).toBe(false);
+ expect(rules.some(r => r.includes('.astryx-text.accent'))).toBe(true);
});
// --- Consistency ---
@@ -194,9 +195,7 @@ describe('generateThemeRules', () => {
it('generateThemeCSS returns prose and component blocks with @scope', () => {
const {prose, component} = generateThemeCSS(theme);
const combined = prose + component;
- expect(combined).toContain(
- '@scope ([data-astryx-theme="default"])',
- );
+ expect(combined).toContain('@scope ([data-astryx-theme="default"])');
expect(combined).toContain('to ([data-astryx-theme])');
// Every rule from generateThemeRules should appear in one of the blocks
for (const rule of rules) {
diff --git a/packages/core/src/theme/generateThemeRules.ts b/packages/core/src/theme/generateThemeRules.ts
index 163b21c5c5..5439f1c1cc 100644
--- a/packages/core/src/theme/generateThemeRules.ts
+++ b/packages/core/src/theme/generateThemeRules.ts
@@ -472,7 +472,7 @@ function generateColorOverrides(
secondary: 'var(--color-text-secondary)',
disabled: 'var(--color-text-disabled)',
placeholder: 'var(--color-text-secondary)',
- active: 'var(--color-accent)',
+ accent: 'var(--color-text-accent)',
};
const touchesText = 'text' in components;
diff --git a/packages/core/src/theme/types.ts b/packages/core/src/theme/types.ts
index df29c63205..aa618cdabd 100644
--- a/packages/core/src/theme/types.ts
+++ b/packages/core/src/theme/types.ts
@@ -162,7 +162,7 @@ export type TextColor =
| 'secondary'
| 'disabled'
| 'placeholder'
- | 'active'
+ | 'accent'
| 'inherit';
/**