Skip to content

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

TypeScript

feat(theme): add butter theme (#2151)

sheryl7c829e49622f
diff --git a/apps/sandbox/package.json b/apps/sandbox/package.json
index 0efd9920d7..c7a8c6fb4d 100644
--- a/apps/sandbox/package.json
+++ b/apps/sandbox/package.json
@@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
- "build:deps": "yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-matcha build && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-stone build && yarn workspace @xds/theme-gothic build && yarn workspace @xds/theme-chocolate build && yarn workspace @xds/theme-y2k build",
+ "build:deps": "yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-matcha build && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-stone build && yarn workspace @xds/theme-gothic build && yarn workspace @xds/theme-chocolate build && yarn workspace @xds/theme-y2k build && yarn workspace @xds/theme-butter build",
"generate:versions": "node scripts/generate-versions.js",
"generate:changelog": "node scripts/generate-changelog.js",
"generate:cli": "node scripts/generate-cli-registry.mjs",
@@ -32,7 +32,8 @@
"@xds/theme-stone": "*",
"@xds/theme-gothic": "*",
"@xds/theme-chocolate": "*",
- "@xds/theme-y2k": "*"
+ "@xds/theme-y2k": "*",
+ "@xds/theme-butter": "*"
},
"devDependencies": {
"@babel/preset-react": "^7.25.0",
@@ -45,4 +46,4 @@
"typescript": "^6.0.3",
"@xds/build": "*"
}
-}
+}
\ No newline at end of file
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/butter-palette/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/butter-palette/page.tsx
new file mode 100644
index 0000000000..c633643e05
--- /dev/null
+++ b/apps/sandbox/src/app/(fullscreen)/pages/butter-palette/page.tsx
@@ -0,0 +1,113 @@
+'use client';
+
+import {XDSVStack} from '@xds/core/Layout';
+import {butterTheme} from '@xds/theme-butter/built';
+import {butterPalettes} from '@xds/theme-butter';
+import {ThemePalettePreview} from '@/components/ThemePalettePreview';
+
+const SARINA = "'Sarina', cursive";
+
+// 14 brand palettes shown in the design spec. Tonal ramps come straight
+// from the theme's pre-computed palette so the displayed strip exactly
+// matches the card / badge / banner tokens.
+const TONAL_COLORS = [
+ {name: 'Accent', sourceHex: '#225BFF', tones: butterPalettes.accent, dark: {sourceHex: '#FDEE8C', tones: butterPalettes.yellow}},
+ {name: 'Gray', sourceHex: '#868B99', tones: butterPalettes.neutral},
+ {name: 'Red', sourceHex: '#FF7553', tones: butterPalettes.red},
+ {name: 'Orange', sourceHex: '#FFA347', tones: butterPalettes.orange},
+ {name: 'Yellow', sourceHex: '#EDD64B', tones: butterPalettes.yellow, dark: {sourceHex: '#EDD64B', tones: {0:'#000000',5:'#161100',10:'#211b00',15:'#2c2600',20:'#383100',25:'#443c00',30:'#504700',35:'#5d5300',40:'#6a5f00',45:'#786b00',50:'#867800',55:'#948500',60:'#a29200',65:'#b19f00',70:'#bfac1a',75:'#ceba2c',80:'#ddc73c',85:'#ecd54a',90:'#fbe358',95:'#fff1bd',100:'#ffffff'}}},
+ {name: 'Green', sourceHex: '#5DCE5F', tones: butterPalettes.green},
+ {name: 'Cyan', sourceHex: '#60CFD3', tones: butterPalettes.cyan},
+ {name: 'Teal', sourceHex: '#6CD9A8', tones: butterPalettes.teal},
+ {name: 'Blue', sourceHex: '#5681FF', tones: butterPalettes.blue},
+ {name: 'Purple', sourceHex: '#B780F6', tones: butterPalettes.purple},
+ {name: 'Pink', sourceHex: '#F680E8', tones: butterPalettes.pink},
+ {
+ name: 'Error',
+ sourceHex: '#FF5947',
+ tones: butterPalettes.error,
+ semantic: 'Error',
+ },
+ {
+ name: 'Warning',
+ sourceHex: '#F8C726',
+ tones: butterPalettes.warning,
+ semantic: 'Warning',
+ },
+ {
+ name: 'Success',
+ sourceHex: '#91D143',
+ tones: butterPalettes.success,
+ semantic: 'Success',
+ },
+];
+
+const CORE = [
+ {hex: '#225BFF', name: '#225BFF', dark: {hex: '#FDEE8C', name: '#FDEE8C'}},
+ {hex: '#5681FF', name: '#5681FF', dark: {hex: '#EDD64B', name: '#EDD64B'}},
+ {hex: '#FDEE8C', name: '#FDEE8C', dark: {hex: '#725538', name: '#725538'}},
+ {hex: '#FDFBE4', name: '#FDFBE4', dark: {hex: '#36261C', name: '#36261C'}},
+ {hex: '#FFFFFF', name: '#FFFFFF', dark: {hex: '#261A13', name: '#261A13'}},
+];
+
+const sectionTitle: React.CSSProperties = {
+ fontSize: 13,
+ fontWeight: 600,
+ margin: 0,
+ marginBottom: 12,
+};
+
+function DisplayTextSection() {
+ // Brand-blue in light mode, butter yellow in dark mode.
+ const displayColor = 'light-dark(#225BFF, #FDEE8C)';
+ return (
+ <div>
+ <h3 style={sectionTitle}>Display Text (Sarina)</h3>
+ <XDSVStack gap={2}>
+ <span
+ style={{
+ fontFamily: SARINA,
+ fontSize: 83,
+ fontWeight: 400,
+ lineHeight: 1.15,
+ color: displayColor,
+ }}>
+ Display 1
+ </span>
+ <span
+ style={{
+ fontFamily: SARINA,
+ fontSize: 67,
+ fontWeight: 400,
+ lineHeight: 1.15,
+ color: displayColor,
+ }}>
+ Display 2
+ </span>
+ <span
+ style={{
+ fontFamily: SARINA,
+ fontSize: 53,
+ fontWeight: 400,
+ lineHeight: 1.2,
+ color: displayColor,
+ }}>
+ Display 3
+ </span>
+ </XDSVStack>
+ </div>
+ );
+}
+
+export default function ButterPalettePage() {
+ return (
+ <ThemePalettePreview
+ theme={butterTheme}
+ title="Butter Theme Palette"
+ subtitle="Golden buttery theme with blue accents. Sarina for Display, Outfit for headings and body."
+ tonalColors={TONAL_COLORS}
+ coreSwatches={CORE}
+ leadingExtras={<DisplayTextSection />}
+ />
+ );
+}
diff --git a/apps/sandbox/src/app/globals.css b/apps/sandbox/src/app/globals.css
index 3c1f754ccc..20d1fc9563 100644
--- a/apps/sandbox/src/app/globals.css
+++ b/apps/sandbox/src/app/globals.css
@@ -9,5 +9,6 @@
@import "@xds/theme-gothic/theme.css";
@import "@xds/theme-chocolate/theme.css";
@import "@xds/theme-y2k/theme.css";
+@import "@xds/theme-butter/theme.css";
@stylex;
diff --git a/apps/sandbox/src/app/layout.tsx b/apps/sandbox/src/app/layout.tsx
index 55463db4b0..06f410ad1d 100644
--- a/apps/sandbox/src/app/layout.tsx
+++ b/apps/sandbox/src/app/layout.tsx
@@ -19,7 +19,7 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
/>
<link
rel="stylesheet"
- href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=Fustat:wght@400;500;600;700&family=Manufacturing+Consent&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
+ href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=Fustat:wght@400;500;600;700&family=Manufacturing+Consent&family=Outfit:wght@400;500;600;700&family=Sarina&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
/>
{/* Prevent PreviewShell toolbar flash when loaded inside an iframe.
Runs before paint so the toolbar is never visible in embed contexts. */}
diff --git a/apps/sandbox/src/app/sandboxPages.ts b/apps/sandbox/src/app/sandboxPages.ts
index 3a34b40be3..1810e1e7a8 100644
--- a/apps/sandbox/src/app/sandboxPages.ts
+++ b/apps/sandbox/src/app/sandboxPages.ts
@@ -145,6 +145,12 @@ export const categories: SandboxCategory[] = [
description:
'Gothic dark-only theme — atmospheric blue-gray, distressed display heading, pastel categorical accents',
},
+ {
+ name: 'Butter Palette',
+ href: '/pages/butter-palette/',
+ description:
+ 'Butter theme — golden buttery palette with blue accents, Sarina display, Outfit body & headings',
+ },
{
name: 'Color Studio',
href: '/pages/color-studio/',
diff --git a/apps/sandbox/src/components/ThemePalettePreview.tsx b/apps/sandbox/src/components/ThemePalettePreview.tsx
index aa23078d81..b8953e88fc 100644
--- a/apps/sandbox/src/components/ThemePalettePreview.tsx
+++ b/apps/sandbox/src/components/ThemePalettePreview.tsx
@@ -232,11 +232,34 @@ export interface TonalColor {
sourceHex: string;
semantic?: string;
note?: string;
+ /**
+ * Optional pre-computed tonal ramp keyed by tone (0-100).
+ * When provided, the preview renders these exact values instead of
+ * deriving them from `sourceHex` via the built-in HCT algorithm —
+ * use this to keep the displayed strip in sync with the theme's
+ * own hand-tuned palette (so card/badge variants visually match).
+ *
+ * Numeric keys are interpreted as tone steps; non-numeric keys
+ * (e.g. `hue`, `chroma`) are ignored. This shape matches theme
+ * palette exports like `butterPalettes.blue`.
+ */
+ tones?: Readonly<Record<string | number, string | number>>;
+ /**
+ * Optional dark-mode overrides. When present, these values replace
+ * `sourceHex` and `tones` in the dark mode column — allowing fully
+ * curated per-mode tonal ramps without duplicating the full array.
+ */
+ dark?: {
+ sourceHex?: string;
+ tones?: Readonly<Record<string | number, string | number>>;
+ };
}
export interface CoreSwatch {
hex: string;
name: string;
+ /** Optional dark-mode override. When present, replaces hex and name in the dark column. */
+ dark?: { hex: string; name: string };
}
export interface ThemePalettePreviewProps {
@@ -360,7 +383,7 @@ const S = {
({
background: bg,
borderRadius: 10,
- border: '1px solid rgba(0,0,0,0.08)',
+ border: '1px solid light-dark(rgba(0,0,0,0.08), rgba(255,255,255,0.15))',
height: 88,
}) as React.CSSProperties,
coreMeta: {
@@ -456,20 +479,24 @@ const S = {
// Section components
// =============================================================================
-function CoreSection({swatches}: {swatches: CoreSwatch[]}) {
+function CoreSection({swatches, mode}: {swatches: CoreSwatch[]; mode?: Mode}) {
+ const isDark = mode === 'dark';
return (
<div style={S.section}>
<h3 style={S.sectionTitle}>Core Palette</h3>
<div style={S.coreRow}>
- {swatches.map(c => (
- <div key={c.hex}>
- <div style={S.coreSwatch(c.hex)} />
- <div style={S.coreMeta}>
- <div>{c.name}</div>
- <div>{c.hex}</div>
+ {swatches.map(c => {
+ const hex = (isDark && c.dark?.hex) || c.hex;
+ const name = (isDark && c.dark?.name) || c.name;
+ return (
+ <div key={hex}>
+ <div style={S.coreSwatch(hex)} />
+ <div style={S.coreMeta}>
+ {name && <div>{name}</div>}
+ </div>
</div>
- </div>
- ))}
+ );
+ })}
</div>
</div>
);
@@ -984,9 +1011,23 @@ function TonalSection({
)}{' '}
Badge tokens use T90/T30 (light) and T70/T15 (dark).
</p>
- {colors.map(({name, sourceHex, semantic, note}) => {
- const hct = hexToHct(sourceHex);
- const tones = tonalPaletteForMode(hct.hue, hct.chroma, mode);
+ {colors.map(({name, sourceHex, semantic, note, tones: overrideTones, dark}) => {
+ // In dark mode, use per-mode overrides if provided.
+ const effectiveSourceHex = (isDark && dark?.sourceHex) || sourceHex;
+ const effectiveTones = (isDark && dark?.tones) || overrideTones;
+ const hct = hexToHct(effectiveSourceHex);
+ const computedTones = tonalPaletteForMode(hct.hue, hct.chroma, mode);
+ // Theme override wins when it has a hex for this step; otherwise
+ // fall back to the algorithm so the strip is always a full 21-step
+ // ramp (no missing cells when the theme defines a subset).
+ const resolveTone = (t: number): string => {
+ if (effectiveTones) {
+ const v = effectiveTones[t];
+ if (typeof v === 'string') return v;
+ }
+ return computedTones[t];
+ };
+ const steps = TONE_STEPS;
return (
<div key={name} style={S.tonalRow}>
<span style={S.tonalLabel}>
@@ -1003,18 +1044,21 @@ function TonalSection({
)}
</span>
<div style={S.tonalStrip}>
- {TONE_STEPS.map(t => (
- <div
- key={t}
- style={{
- ...S.tonalCell(tones[t]),
- position: 'relative' as const,
- }}
- title={`${name} T${t}: ${tones[t]}`}>
- <span style={S.tonalNum(t)}>{t}</span>
- {usedTones.includes(t) && <div style={S.markerDot(t)} />}
- </div>
- ))}
+ {steps.map(t => {
+ const hex = resolveTone(t);
+ return (
+ <div
+ key={t}
+ style={{
+ ...S.tonalCell(hex),
+ position: 'relative' as const,
+ }}
+ title={`${name} T${t}: ${hex}`}>
+ <span style={S.tonalNum(t)}>{t}</span>
+ {usedTones.includes(t) && <div style={S.markerDot(t)} />}
+ </div>
+ );
+ })}
</div>
<span style={S.tonalHct}>
H:{hct.hue.toFixed(0)} C:{hct.chroma.toFixed(0)}
@@ -1076,7 +1120,9 @@ function ModeColumn({
{mode === 'light' ? 'Light Mode' : 'Dark Mode'}
</p>
)}
- {coreSwatches && coreSwatches.length > 0 && <CoreSection swatches={coreSwatches} />}
+ {coreSwatches && coreSwatches.length > 0 && (
+ <CoreSection swatches={coreSwatches} mode={mode} />
+ )}
{leadingExtras}
<TextRampSection />
<SemanticBadgeSection />
diff --git a/package.json b/package.json
index d7df9fd8dd..d48a8c662e 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
"internal/*"
],
"scripts": {
- "build": "yarn workspace @xds/core build && yarn workspace @xds/vega build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-matcha build && yarn workspace @xds/theme-stone build && yarn workspace @xds/theme-gothic build && yarn workspace @xds/theme-chocolate build && yarn workspace @xds/theme-y2k build",
+ "build": "yarn workspace @xds/core build && yarn workspace @xds/vega build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-matcha build && yarn workspace @xds/theme-stone build && yarn workspace @xds/theme-gothic build && yarn workspace @xds/theme-chocolate build && yarn workspace @xds/theme-y2k build && yarn workspace @xds/theme-butter build",
"dev": "yarn workspace @xds/storybook dev",
"test": "vitest run",
"test:watch": "vitest",
@@ -75,4 +75,4 @@
"*.{ts,tsx}": "eslint --cache --fix",
"*.{ts,tsx,md}": "prettier --write"
}
-}
+}
\ No newline at end of file
diff --git a/packages/themes/butter/README.md b/packages/themes/butter/README.md
new file mode 100644
index 0000000000..9376c05708
--- /dev/null
+++ b/packages/themes/butter/README.md
@@ -0,0 +1,57 @@
+# @xds/theme-butter
+
+Golden buttery theme for XDS with blue accents. Sarina for display type, Outfit for headings and body.
+
+## Install
+
+```bash
+npm install @xds/theme-butter
+```
+
+## Usage
+
+```tsx
+import {butterTheme} from '@xds/theme-butter/built';
+import {XDSTheme} from '@xds/core/theme';
+import '@xds/theme-butter/theme.css';
+
+function App() {
+ return <XDSTheme theme={butterTheme}>{/* Your app content */}</XDSTheme>;
+}
+```
+
+## Colors
+
+Source palette:
+
+| Role | Hex |
+| ------- | --------- |
+| Accent | `#225BFF` |
+| Yellow | `#FDEE8C` |
+| Error | `#FC473B` |
+| Warning | `#FFC502` |
+| Success | `#91D143` |
+| Info | `#4883FD` |
+
+Each color (Blue, Cyan, Green, Orange, Pink, Purple, Red, Teal, Yellow,
+plus Error / Warning / Success) is published as a smooth 21-step tonal
+palette in `butterPalettes`. Categorical badges, cards, and banner text
+roles read from these palettes via:
+
+- `T90` light / `T15` dark — background surfaces
+- `T80` light / `T25` dark — borders, dark-mode text
+- `T25` light / `T80` dark — light-mode text, icons
+
+To regenerate the palettes after changing a source color, edit the
+`SOURCES` map in `scripts/generate-palettes.mjs`, run the script, and
+paste the output back into `src/butterTheme.ts`.
+
+## Typography
+
+- **Display**: Sarina (cursive) — applied per-page via inline style.
+- **Heading & Body**: Outfit, base 14px, ratio 1.25.
+- **Code**: JetBrains Mono.
+
+Sarina and Outfit ship via Google Fonts. Add the appropriate
+`<link rel="stylesheet" href="...">` to your document `<head>` to avoid
+runtime font fetching.
diff --git a/packages/themes/butter/package.json b/packages/themes/butter/package.json
new file mode 100644
index 0000000000..469954a7fb
--- /dev/null
+++ b/packages/themes/butter/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "@xds/theme-butter",
+ "version": "0.0.13",
+ "displayName": "Butter Theme",
+ "private": false,
+ "description": "Warm, golden butter theme for XDS — creamy yellow palette with soft, inviting tones",
+ "author": "Meta Open Source",
+ "license": "MIT",
+ "homepage": "https://github.com/facebookexperimental/xds#readme",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/facebookexperimental/xds.git",
+ "directory": "packages/themes/butter"
+ },
+ "bugs": {
+ "url": "https://github.com/facebookexperimental/xds/issues"
+ },
+ "keywords": [
+ "xds",
+ "theme",
+ "design-system",
+ "lucide",
+ "design-tokens"
+ ],
+ "sideEffects": false,
+ "main": "./dist/source.js",
+ "types": "./dist/source.d.ts",
+ "exports": {
+ ".": {
+ "types": "./dist/source.d.ts",
+ "import": "./dist/source.mjs",
+ "require": "./dist/source.js"
+ },
+ "./built": {
+ "types": "./dist/butter.d.ts",
+ "import": "./dist/butter.js",
+ "require": "./dist/butter.js"
+ },
+ "./theme.css": {
+ "types": "./theme.css.d.ts",
+ "default": "./dist/theme.css"
+ }
+ },
+ "files": [
+ "dist",
+ "src"
+ ],
+ "scripts": {
+ "build": "xds theme build src/butterTheme.ts -o dist/theme.css && tsup && tsc --project tsconfig.build.json"
+ },
+ "dependencies": {
+ "lucide-react": "^1.14.0"
+ },
+ "peerDependencies": {
+ "@xds/core": "0.0.13",
+ "react": ">=19"
+ },
+ "devDependencies": {
+ "@xds/cli": "0.0.13"
+ },
+ "module": "./dist/source.mjs"
+}
diff --git a/packages/themes/butter/scripts/generate-palettes.mjs b/packages/themes/butter/scripts/generate-palettes.mjs
new file mode 100644
index 0000000000..801cb48959
--- /dev/null
+++ b/packages/themes/butter/scripts/generate-palettes.mjs
@@ -0,0 +1,102 @@
+/**
+ * Butter theme palette generator — single-anchor smooth ramp.
+ *
+ * Each palette has ONE anchor source (a hex from the current design).
+ * The full 21-step ramp is derived via the same CIELab → HCT algorithm
+ * the preview strip uses (see ThemePalettePreview.tsx). This produces
+ * a smooth, organic gradient without piecewise discontinuities.
+ *
+ * The four "in-use" tones (T15/T25/T80/T90) will be CLOSE to but not
+ * necessarily exactly equal to the current token values. The script
+ * prints both the new T-stops and the deltas vs the previous tokens so
+ * we can see how much they shifted.
+ *
+ * Run: node packages/themes/butter/scripts/generate-palettes.mjs
+ */
+
+function hexToRgb(hex){const h=hex.replace('#','').slice(0,6);const f=h.length===3?h[0]+h[0]+h[1]+h[1]+h[2]+h[2]:h;const n=parseInt(f,16);return[(n>>16)&255,(n>>8)&255,n&255];}
+function srgbToLinear(c){const s=c/255;return s<=0.04045?s/12.92:Math.pow((s+0.055)/1.055,2.4);}
+function linearToSrgb(c){const s=c<=0.0031308?c*12.92:1.055*Math.pow(c,1/2.4)-0.055;return Math.round(Math.min(255,Math.max(0,s*255)));}
+function linRgbToXyz(r,g,b){return[0.4124564*r+0.3575761*g+0.1804375*b,0.2126729*r+0.7151522*g+0.072175*b,0.0193339*r+0.119192*g+0.9503041*b];}
+function xyzToLinRgb(x,y,z){return[3.2404542*x-1.5371385*y-0.4985314*z,-0.969266*x+1.8760108*y+0.041556*z,0.0556434*x-0.2040259*y+1.0572252*z];}
+const D65=[0.95047,1,1.08883];
+function labF(t){const d=6/29;return t>d*d*d?Math.cbrt(t):t/(3*d*d)+4/29;}
+function labFInv(t){const d=6/29;return t>d?t*t*t:3*d*d*(t-4/29);}
+function xyzToLab(x,y,z){const fx=labF(x/D65[0]),fy=labF(y/D65[1]),fz=labF(z/D65[2]);return[116*fy-16,500*(fx-fy),200*(fy-fz)];}
+function labToXyz(L,a,b){const fy=(L+16)/116,fx=a/500+fy,fz=fy-b/200;return[labFInv(fx)*D65[0],labFInv(fy)*D65[1],labFInv(fz)*D65[2]];}
+
+function hexToHct(hex){
+ const[r,g,b]=hexToRgb(hex);
+ const[x,y,z]=linRgbToXyz(srgbToLinear(r),srgbToLinear(g),srgbToLinear(b));
+ const[L,a,bL]=xyzToLab(x,y,z);
+ let h=Math.atan2(bL,a)*180/Math.PI;if(h<0)h+=360;
+ return{hue:h,chroma:Math.sqrt(a*a+bL*bL),tone:Math.max(0,Math.min(100,L))};
+}
+
+function hctToHex({hue,chroma,tone}){
+ if(tone<=0)return'#000000';
+ if(tone>=100)return'#ffffff';
+ if(chroma<0.5){const y=labFInv((tone+16)/116);const g=linearToSrgb(y);return'#'+[g,g,g].map(c=>c.toString(16).padStart(2,'0')).join('');}
+ let lo=0,hi=chroma,best='#000000';
+ for(let i=0;i<16;i++){
+ const mid=(lo+hi)/2,hRad=hue*Math.PI/180;
+ const a=Math.cos(hRad)*mid,b=Math.sin(hRad)*mid;
+ const[x,y,z]=labToXyz(tone,a,b);
+ const[lr,lg,lb]=xyzToLinRgb(x,y,z);
+ const r=linearToSrgb(lr),g=linearToSrgb(lg),bv=linearToSrgb(lb);
+ const ok=Math.abs(srgbToLinear(r)-lr)<0.02&&Math.abs(srgbToLinear(g)-lg)<0.02&&Math.abs(srgbToLinear(bv)-lb)<0.02&&r>=0&&r<=255&&g>=0&&g<=255&&bv>=0&&bv<=255;
+ if(ok){best='#'+[r,g,bv].map(c=>c.toString(16).padStart(2,'0')).join('');lo=mid;}
+ else{hi=mid;}
+ }
+ return best;
+}
+
+const STEPS = [0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100];
+
+function tonalPalette(hue, chroma) {
+ const out = {};
+ const maxChroma = chroma * 1.8;
+ for (const t of STEPS) {
+ const boost = t < 50 ? 1 + (50 - t) / 40 : 1;
+ out[t] = hctToHex({ hue, chroma: Math.min(chroma * boost, maxChroma), tone: t });
+ }
+ return out;
+}
+
+// Sources picked from the CURRENT token values that look right.
+// Using T80 (light border) as the source for each palette keeps the
+// mid-light tone honest and lets the ramp fan out smoothly to both
+// ends. For ramps where T80 is too saturated to fan well (yellow),
+// we use a slightly higher tone as source.
+const SOURCES = {
+ blue: '#bdc5eb',
+ cyan: '#8dd2d3',
+ green: '#a5d29d',
+ orange: '#f2bd81',
+ pink: '#f0b3e8',
+ purple: '#ddb9f6',
+ red: '#f4b8ae',
+ teal: '#94d3bb',
+ yellow: '#e5d765',
+ neutral: '#c1c6d5',
+ accent: '#225BFF',
+ error: '#ffb3a5',
+ warning: '#f7be00',
+ success: '#91D143',
+};
+
+const out = {};
+for (const [name, src] of Object.entries(SOURCES)) {
+ const { hue, chroma } = hexToHct(src);
+ out[name] = tonalPalette(hue, chroma);
+}
+
+let formatted = 'export const butterPalettes = {\n';
+for (const [name, palette] of Object.entries(out)) {
+ formatted += ` ${name}: {\n`;
+ for (const t of STEPS) formatted += ` ${t}: '${palette[t]}',\n`;
+ formatted += ' },\n';
+}
+formatted += '} as const;\n';
+
+console.log(formatted);
diff --git a/packages/themes/butter/src/butterTheme.ts b/packages/themes/butter/src/butterTheme.ts
new file mode 100644
index 0000000000..bc0ca21dd7
--- /dev/null
+++ b/packages/themes/butter/src/butterTheme.ts
@@ -0,0 +1,867 @@
+/**
+ * Butter Theme
+ *
+ * Warm, golden buttery theme with blue accents.
+ * Sarina for display, Outfit for headings and body.
+ *
+ * Source palette (per design):
+ * Accent #225BFF Gray #868B99 Red #FF7553
+ * Orange #FFA347 Yellow #fdee8c Green #5DCE5F
+ * Cyan #60CFD3 Teal #6CD9A8 Blue #5681FF
+ * Purple #B780F6 Pink #F680E8 Error #FF5947
+ * Warning #F8C726 Success #91D143
+ *
+ * All tonal ramps derived in CIELab (matches the algorithm used by
+ * ThemePalettePreview so card / badge / banner / strip render the
+ * same values). Regen via scripts/butter-palette-gen.mjs if sources
+ * change.
+ */
+
+import {defineTheme, defineSyntaxTheme} from '@xds/core/theme';
+import {butterIconRegistry} from './icons';
+
+/** Butter syntax palette — T25 / T80 of each color's ramp. */
+const butterSyntax = defineSyntaxTheme({
+ name: 'xds-butter',
+ tokens: {
+ keyword: ['#52237b', '#ddb9f6'], // Purple
+ string: ['#004800', '#a5d29d'], // Green
+ comment: ['#605f52', '#adac9e'],
+ number: ['#622e00', '#f2bd81'], // Orange
+ function: ['#203a6c', '#bdc5eb'], // Blue
+ type: ['#52237b', '#ddb9f6'], // Purple
+ variable: ['#605f52', '#adac9e'],
+ operator: ['#605f52', '#adac9e'],
+ constant: ['#622e00', '#f2bd81'],
+ tag: ['#6d211c', '#f4b8ae'], // Red
+ attribute: ['#413e00', '#d6c957'], // Yellow
+ property: ['#00482d', '#94d3bb'], // Teal
+ punctuation: ['#605f52', '#adac9e'],
+ background: ['#FDFBE4', '#131107'],
+ },
+});
+
+export const butterTheme = defineTheme({
+ name: 'butter',
+
+ typography: {
+ scale: {base: 14, ratio: 1.25},
+ body: {
+ family: 'Outfit',
+ fallbacks:
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
+ },
+ heading: {
+ family: 'Outfit',
+ fallbacks:
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
+ weights: {3: 'bold', 4: 'bold'},
+ },
+ code: {
+ family: 'JetBrains Mono',
+ fallbacks: '"SF Mono", Monaco, Consolas, monospace',
+ },
+ },
+
+ motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
+
+ syntax: butterSyntax,
+
+ tokens: {
+ // =========================================================================
+ // Core semantic — accent is the exact brand #225BFF
+ // =========================================================================
+ '--color-accent': ['#225BFF', '#FDEE8C'],
+ '--color-accent-muted': ['#225BFF33', '#FDEE8C40'],
+ '--color-neutral': ['#1d1c110F', '#f3f2e21A'],
+ '--color-background-surface': ['#FFFFFF', '#2E2117'],
+ '--color-background-body': ['#FDFBE4', '#261A13'],
+ '--color-overlay': ['#1d1c1180', '#261A13cc'],
+ '--color-overlay-hover': ['#1d1c110D', '#f3f2e20D'],
+ '--color-overlay-pressed': ['#1d1c111A', '#f3f2e21A'],
+ '--color-background-muted': ['#f3f2e2', '#3A2A1F'],
+
+ // Text — warm neutral
+ '--color-text-primary': ['#1d1c11', '#f3f2e2'],
+ '--color-text-secondary': ['#605f52', '#adac9e'],
+ '--color-text-disabled': ['#adac9e', '#605f52'],
+ '--color-text-accent': ['#225BFF', '#FDEE8C'],
+ '--color-on-dark': '#ffffff',
+ '--color-on-light': '#1d1c11',
+ '--color-on-accent': ['#ffffff', '#1d1c11'],
+ // T95 of each ramp for use on the vivid semantic surfaces.
+ '--color-on-success': ['#ccff88', '#0b2e00'],
+ '--color-on-error': ['#ffe3de', '#600000'],
+ '--color-on-warning': ['#ffeec3', '#3b2200'],
+
+ // Icon
+ '--color-icon-accent': ['#225BFF', '#FDEE8C'],
+ '--color-icon-primary': ['#1d1c11', '#f3f2e2'],
+ '--color-icon-secondary': ['#605f52', '#adac9e'],
+ '--color-icon-disabled': ['#adac9e', '#605f52'],
+
+ // Surface variants
+ '--color-background-card': ['#FFFFFF', '#3A2A1F'],
+ '--color-background-popover': ['#FFFFFF', '#3A2A1F'],
+ '--color-background-inverted': ['#1d1c11', '#FDFBE4'],
+
+ // Status semantics — T25 light / T80 dark from each status palette.
+ '--color-error': ['#771210', '#ffb4a6'],
+ '--color-error-muted': ['#77121033', '#ffb4a640'],
+ '--color-warning': ['#543700', '#f7be00'],
+ '--color-warning-muted': ['#54370033', '#f7be0040'],
+ '--color-success': ['#004700', '#99d94b'],
+ '--color-success-muted': ['#00470033', '#99d94b40'],
+
+ // Border
+ '--color-border': ['#e5e3d4', '#f3f2e21A'],
+ '--color-border-emphasized': ['#79786a', '#939184'],
+
+ // Effects
+ '--color-skeleton': ['#e5e3d4', '#49473b'],
+ '--color-shadow': ['#1d1c111A', '#0000004D'],
+ '--color-tint-hover': ['black', 'white'],
+
+ // Typography override
+ '--text-supporting-size': '12px',
+
+ // Element sizes — slightly taller defaults so the new input padding
+ // (--spacing-2 block) has room to breathe.
+ '--size-element-sm': '32px',
+ '--size-element-md': '40px',
+ '--size-element-lg': '48px',
+
+ // =========================================================================
+ // Categorical — same values in light and dark mode (curated dark mode
+ // keeps the same pastel backgrounds + dark text as light mode).
+ // =========================================================================
+
+ // Blue
+ '--color-background-blue': ['#dbe1ff', '#dbe1ff'],
+ '--color-border-blue': ['#bdc5eb', '#bdc5eb'],
+ '--color-icon-blue': ['#203a6c', '#203a6c'],
+ '--color-text-blue': ['#203a6c', '#203a6c'],
+
+ // Cyan
+ '--color-background-cyan': ['#a9eff0', '#a9eff0'],
+ '--color-border-cyan': ['#8dd2d3', '#8dd2d3'],
+ '--color-icon-cyan': ['#004649', '#004649'],
+ '--color-text-cyan': ['#004649', '#004649'],
+
+ // Gray (uses the neutral palette)
+ '--color-background-gray': ['#f0edd4', '#f0edd4'],
+ '--color-border-gray': ['#d6d3b8', '#d6d3b8'],
+ '--color-icon-gray': ['#4a4732', '#4a4732'],
+ '--color-text-gray': ['#4a4732', '#4a4732'],
+
+ // Green
+ '--color-background-green': ['#c1efb8', '#c1efb8'],
+ '--color-border-green': ['#a5d29d', '#a5d29d'],
+ '--color-icon-green': ['#004800', '#004800'],
+ '--color-text-green': ['#004800', '#004800'],
+
+ // Orange
+ '--color-background-orange': ['#ffdcb6', '#ffdcb6'],
+ '--color-border-orange': ['#f2bd81', '#f2bd81'],
+ '--color-icon-orange': ['#622e00', '#622e00'],
+ '--color-text-orange': ['#622e00', '#622e00'],
+
+ // Pink
+ '--color-background-pink': ['#ffd5fb', '#ffd5fb'],
+ '--color-border-pink': ['#f0b3e8', '#f0b3e8'],
+ '--color-icon-pink': ['#6c0a68', '#6c0a68'],
+ '--color-text-pink': ['#6c0a68', '#6c0a68'],
+
+ // Purple
+ '--color-background-purple': ['#f2daff', '#f2daff'],
+ '--color-border-purple': ['#ddb9f6', '#ddb9f6'],
+ '--color-icon-purple': ['#52237b', '#52237b'],
+ '--color-text-purple': ['#52237b', '#52237b'],
+
+ // Red
+ '--color-background-red': ['#ffdad3', '#ffdad3'],
+ '--color-border-red': ['#f4b8ae', '#f4b8ae'],
+ '--color-icon-red': ['#6d211c', '#6d211c'],
+ '--color-text-red': ['#6d211c', '#6d211c'],
+
+ // Teal
+ '--color-background-teal': ['#b0f0d7', '#b0f0d7'],
+ '--color-border-teal': ['#94d3bb', '#94d3bb'],
+ '--color-icon-teal': ['#00482d', '#00482d'],
+ '--color-text-teal': ['#00482d', '#00482d'],
+
+ // Yellow
+ '--color-background-yellow': ['#feee7b', '#feee7b'],
+ '--color-border-yellow': ['#d6c957', '#d6c957'],
+ '--color-icon-yellow': ['#413e00', '#413e00'],
+ '--color-text-yellow': ['#413e00', '#413e00'],
+
+ // =========================================================================
+ // Radius
+ // --radius-element drives buttons, badges, inputs — 8px per design
+ // --radius-container drives cards, banners, popovers — 12px per design
+ // =========================================================================
+ '--radius-none': '0.125rem',
+ '--radius-inner': '0.375rem',
+ '--radius-element': '0.5rem', // 8px
+ '--radius-container': '0.75rem', // 12px
+ '--radius-page': '1.5rem',
+ '--radius-full': '9999px',
+
+ // =========================================================================
+ // Shadows — warm neutral tint
+ // =========================================================================
+ '--shadow-low': '0 2px 4px #1d1c110D, 0 4px 8px #1d1c111A',
+ '--shadow-med': '0 2px 4px #1d1c110D, 0 4px 12px #1d1c111A',
+ '--shadow-high': '0 4px 6px #1d1c111A, 0 12px 24px #1d1c1126',
+ '--shadow-inset-hover': 'inset 0px 0px 0px 2px #79786a30',
+ '--shadow-inset-selected': 'inset 0px 0px 0px 2px #79786a50',
+ '--shadow-inset-success': 'inset 0px 0px 0px 2px #00470030',
+ '--shadow-inset-warning': 'inset 0px 0px 0px 2px #54370030',
+ '--shadow-inset-error': 'inset 0px 0px 0px 2px #77121030',
+ },
+
+ components: {
+ button: {
+ // 8px radius, generous padding around the label.
+ base: {
+ borderRadius: 'var(--radius-element)',
+ paddingBlock: 'var(--spacing-3)',
+ paddingInline: 'var(--spacing-4)',
+ },
+ // Secondary: blue outline + label in light, butter yellow in dark.
+ 'variant:secondary': {
+ backgroundColor: 'transparent',
+ borderWidth: '1.5px',
+ borderStyle: 'solid',
+ borderColor: 'light-dark(#225BFF, #FDEE8C)',
+ color: 'light-dark(#225BFF, #FDEE8C)',
+ ':hover': {
+ backgroundColor: 'light-dark(#225BFF14, #FDEE8C14)',
+ },
+ },
+ // Ghost: same accent color as secondary, no background.
+ 'variant:ghost': {
+ color: 'light-dark(#225BFF, #FDEE8C)',
+ },
+ 'variant:destructive': {
+ backgroundColor: 'light-dark(#ffdad3, #f4b8ae)',
+ color: 'light-dark(#550000, #6d211c)',
+ },
+ },
+
+ badge: {
+ // Match astryx/daily badge sizing: 30px tall with 12px horizontal pad.
+ // Use explicit values because butter inherits the standard spacing
+ // scale (where --spacing-3 = 12px), unlike astryx which redefines it.
+ base: {
+ height: '30px',
+ paddingBlock: '0',
+ paddingInline: 'var(--spacing-3)',
+ },
+ // Vivid semantic badges — pinned to the brand colors from the spec.
+ // Info uses the Blue palette source (NOT the brand accent #225BFF).
+ 'variant:info': {
+ backgroundColor: '#4883fd',
+ color: '#ffffff',
+ },
+ 'variant:neutral': {
+ backgroundColor: '#ffee7b',
+ color: '#225BFF',
+ },
+ 'variant:success': {
+ backgroundColor: '#91D143',
+ color: '#1d1c11',
+ },
+ 'variant:warning': {
+ backgroundColor: '#ffc502',
+ color: '#1d1c11',
+ },
+ 'variant:error': {
+ backgroundColor: '#fc473b',
+ color: '#ffffff',
+ },
+ },
+
+ // Banner backgrounds match the semantic badge fills.
+ // Banner status colors — override the muted tokens locally so the
+ // header (which reads --color-*-muted via StyleX) renders vivid fills
+ // matching the badge palette. Scoped to the banner root, doesn't leak.
+ banner: {
+ 'status:info': {
+ '--color-accent-muted': '#4883fd',
+ '--color-text-primary': '#ffffff',
+ '--color-text-secondary': '#ffffff',
+ '--color-accent': '#ffffff',
+ },
+ 'status:success': {
+ '--color-success-muted': '#91D143',
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#1d1c11',
+ '--color-success': '#1d1c11',
+ },
+ 'status:warning': {
+ '--color-warning-muted': '#ffc502',
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#1d1c11',
+ '--color-warning': '#1d1c11',
+ },
+ 'status:error': {
+ '--color-error-muted': '#fc473b',
+ '--color-text-primary': '#ffffff',
+ '--color-text-secondary': '#ffffff',
+ '--color-error': '#ffffff',
+ },
+ },
+
+ card: {
+ base: {
+ borderRadius: 'var(--radius-container)',
+ padding: 'var(--spacing-4)',
+ },
+ 'variant:info': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:success': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:warning': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:error': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:blue': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:cyan': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:gray': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:green': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:orange': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:pink': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:purple': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:red': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:teal': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:yellow': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ 'variant:muted': {
+ '--color-text-primary': '#1d1c11',
+ '--color-text-secondary': '#605f52',
+ },
+ },
+
+ section: {
+ base: {
+ padding: 'var(--spacing-4)',
+ },
+ },
+
+ // Progress bar — white track in light, warm brown in dark. Vivid
+ // semantic fills match the banner colors (Success / Warning / Error).
+ 'progressbar-track': {
+ base: {
+ backgroundColor: 'light-dark(#e5e3d4, #725538)',
+ },
+ },
+ 'progressbar-fill': {
+ 'variant:positive': {
+ backgroundColor: '#91D143',
+ },
+ 'variant:warning': {
+ backgroundColor: '#ffc502',
+ },
+ 'variant:negative': {
+ backgroundColor: '#fc473b',
+ },
+ },
+
+ // Field status bubble — match the corresponding banner colors so the
+ // helper text below an input reads as the same "this is a warning /
+ // error / success" surface as the standalone banner.
+ 'field-status': {
+ 'type:success': {
+ backgroundColor: '#91D143',
+ color: '#1d1c11',
+ },
+ 'type:warning': {
+ backgroundColor: '#ffc502',
+ color: '#1d1c11',
+ },
+ 'type:error': {
+ backgroundColor: '#fc473b',
+ color: '#ffffff',
+ },
+ },
+
+ // Inputs — softer border than default, more vertical breathing room.
+ // Status modifiers also remap the semantic tokens locally so the
+ // status icon + border read as the same vivid hue as the banner
+ // (icons inherit from --color-{success,warning,error}).
+ 'text-input': {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ textarea: {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ 'number-input': {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ 'date-input': {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ 'time-input': {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ selector: {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ 'multi-selector': {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ typeahead: {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ tokenizer: {
+ base: {
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ borderColor: 'var(--color-border)',
+ },
+ 'status:success': {'--color-success': '#91D143'},
+ 'status:warning': {'--color-warning': '#ffc502'},
+ 'status:error': {'--color-error': '#fc473b'},
+ },
+ },
+
+ icons: butterIconRegistry,
+});
+
+/**
+ * Raw tonal palettes — generated from design-spec source hexes via the
+ * same CIELab algorithm `ThemePalettePreview` uses for the displayed
+ * strip, so the rendered ramp and the consumed token values are 1:1.
+ *
+ * Source colors:
+ * accent #225BFF neutral #868B99
+ * red #ffc3b8 orange #ffc98d yellow #feee7b
+ * green #bdebb4 cyan #abf1f1 teal #aeefd6
+ * blue #cdd5fc purple #e6c2ff pink #fec0f5
+ * error #fc473b warning #ffc502 success #91D143
+ *
+ * Categorical sources are the pastel pill hexes from the design spec so
+ * each ramp's T85 lands directly on the card / badge background color.
+ * Semantic sources are vivid so the ramp anchors near the badge fill.
+ *
+ * Regenerate with: node packages/themes/butter/scripts/generate-palettes.mjs
+ */
+export const butterPalettes = {
+ blue: {
+ 0: '#000000',
+ 5: '#001041',
+ 10: '#001b4c',
+ 15: '#002558',
+ 20: '#062f63',
+ 25: '#203a6c',
+ 30: '#324575',
+ 35: '#41517d',
+ 40: '#505d86',
+ 45: '#5f698f',
+ 50: '#6d7698',
+ 55: '#7a82a6',
+ 60: '#878fb3',
+ 65: '#949cc1',
+ 70: '#a2aacf',
+ 75: '#afb7dd',
+ 80: '#bdc5eb',
+ 85: '#cbd3f9',
+ 90: '#dbe1ff',
+ 95: '#edf0ff',
+ 100: '#ffffff',
+ },
+ cyan: {
+ 0: '#000000',
+ 5: '#001d1e',
+ 10: '#00262a',
+ 15: '#003034',
+ 20: '#003a3e',
+ 25: '#004649',
+ 30: '#005255',
+ 35: '#005e61',
+ 40: '#006a6d',
+ 45: '#1f7678',
+ 50: '#3c8183',
+ 55: '#4a8e90',
+ 60: '#579c9d',
+ 65: '#65a9aa',
+ 70: '#72b7b8',
+ 75: '#80c4c5',
+ 80: '#8dd2d3',
+ 85: '#9be0e1',
+ 90: '#a9eff0',
+ 95: '#b7fdfe',
+ 100: '#ffffff',
+ },
+ green: {
+ 0: '#000000',
+ 5: '#001f00',
+ 10: '#002800',
+ 15: '#003100',
+ 20: '#003c00',
+ 25: '#004800',
+ 30: '#01530d',
+ 35: '#1f5f1f',
+ 40: '#346a30',
+ 45: '#467640',
+ 50: '#578151',
+ 55: '#648e5d',
+ 60: '#709c6a',
+ 65: '#7da976',
+ 70: '#8ab783',
+ 75: '#98c490',
+ 80: '#a5d29d',
+ 85: '#b3e0ab',
+ 90: '#c1efb8',
+ 95: '#cffdc6',
+ 100: '#ffffff',
+ },
+ orange: {
+ 0: '#000000',
+ 5: '#2d0600',
+ 10: '#381200',
+ 15: '#461b00',
+ 20: '#542400',
+ 25: '#622e00',
+ 30: '#6d3a00',
+ 35: '#794700',
+ 40: '#845406',
+ 45: '#906121',
+ 50: '#9b6e36',
+ 55: '#a97b42',
+ 60: '#b7874e',
+ 65: '#c6945b',
+ 70: '#d4a267',
+ 75: '#e3af74',
+ 80: '#f2bd81',
+ 85: '#ffcb8e',
+ 90: '#ffdcb6',
+ 95: '#ffedda',
+ 100: '#ffffff',
+ },
+ pink: {
+ 0: '#000000',
+ 5: '#3c003d',
+ 10: '#490048',
+ 15: '#560054',
+ 20: '#62005f',
+ 25: '#6c0a68',
+ 30: '#762371',
+ 35: '#80357a',
+ 40: '#894583',
+ 45: '#93558c',
+ 50: '#9c6496',
+ 55: '#aa71a3',
+ 60: '#b77eb0',
+ 65: '#c58bbe',
+ 70: '#d398cc',
+ 75: '#e2a6da',
+ 80: '#f0b3e8',
+ 85: '#ffc1f6',
+ 90: '#ffd5fb',
+ 95: '#ffeafd',
+ 100: '#ffffff',
+ },
+ purple: {
+ 0: '#000000',
+ 5: '#1e004f',
+ 10: '#2b005c',
+ 15: '#390268',
+ 20: '#461373',
+ 25: '#52237b',
+ 30: '#5d3283',
+ 35: '#69408b',
+ 40: '#744e92',
+ 45: '#7f5c9a',
+ 50: '#8b6aa2',
+ 55: '#9877b0',
+ 60: '#a584bd',
+ 65: '#b391cb',
+ 70: '#c19ed9',
+ 75: '#cfabe8',
+ 80: '#ddb9f6',
+ 85: '#eac8ff',
+ 90: '#f2daff',
+ 95: '#f9ecff',
+ 100: '#ffffff',
+ },
+ red: {
+ 0: '#000000',
+ 5: '#3e0000',
+ 10: '#490000',
+ 15: '#550000',
+ 20: '#62100f',
+ 25: '#6d211c',
+ 30: '#773029',
+ 35: '#823f36',
+ 40: '#8c4d44',
+ 45: '#955b52',
+ 50: '#9f6961',
+ 55: '#ad766d',
+ 60: '#bb837a',
+ 65: '#c99087',
+ 70: '#d79d94',
+ 75: '#e6aba1',
+ 80: '#f4b8ae',
+ 85: '#ffc7bd',
+ 90: '#ffdad3',
+ 95: '#ffece8',
+ 100: '#ffffff',
+ },
+ teal: {
+ 0: '#000000',
+ 5: '#001f00',
+ 10: '#00280b',
+ 15: '#003216',
+ 20: '#003d22',
+ 25: '#00482d',
+ 30: '#005439',
+ 35: '#005f45',
+ 40: '#136b52',
+ 45: '#30775f',
+ 50: '#46826d',
+ 55: '#528f79',
+ 60: '#5f9d86',
+ 65: '#6caa93',
+ 70: '#7ab8a0',
+ 75: '#87c5ae',
+ 80: '#94d3bb',
+ 85: '#a2e1c9',
+ 90: '#b0f0d7',
+ 95: '#befee5',
+ 100: '#ffffff',
+ },
+ yellow: {
+ 0: '#000000',
+ 5: '#1e1200',
+ 10: '#271c00',
+ 15: '#2e2700',
+ 20: '#373200',
+ 25: '#413e00',
+ 30: '#4c4a00',
+ 35: '#575600',
+ 40: '#646200',
+ 45: '#726e00',
+ 50: '#817a00',
+ 55: '#8e860e',
+ 60: '#9c9320',
+ 65: '#aba02f',
+ 70: '#b9ae3d',
+ 75: '#c7bb4a',
+ 80: '#d6c957',
+ 85: '#e5d765',
+ 90: '#f4e572',
+ 95: '#fff294',
+ 100: '#ffffff',
+ },
+ neutral: {
+ 0: '#000000',
+ 5: '#051124',
+ 10: '#101c2f',
+ 15: '#1b263a',
+ 20: '#273045',
+ 25: '#333b4f',
+ 30: '#3f4759',
+ 35: '#4b5264',
+ 40: '#585e6f',
+ 45: '#656a79',
+ 50: '#727784',
+ 55: '#7f8491',
+ 60: '#8c909f',
+ 65: '#999eac',
+ 70: '#a6abba',
+ 75: '#b4b9c7',
+ 80: '#c1c6d5',
+ 85: '#cfd4e3',
+ 90: '#dde2f2',
+ 95: '#ebf0ff',
+ 100: '#ffffff',
+ },
+ accent: {
+ 0: '#000000',
+ 5: '#00085e',
+ 10: '#00136c',
+ 15: '#001c7e',
+ 20: '#002592',
+ 25: '#002fa7',
+ 30: '#0039be',
+ 35: '#0043d7',
+ 40: '#004df0',
+ 45: '#0759ff',
+ 50: '#4a67ff',
+ 55: '#6875ff',
+ 60: '#8083ff',
+ 65: '#9492ff',
+ 70: '#a6a1ff',
+ 75: '#b6b0ff',
+ 80: '#c6bfff',
+ 85: '#d5cfff',
+ 90: '#e3dfff',
+ 95: '#f1efff',
+ 100: '#ffffff',
+ },
+ error: {
+ 0: '#000000',
+ 5: '#470000',
+ 10: '#530000',
+ 15: '#600000',
+ 20: '#6d0000',
+ 25: '#771210',
+ 30: '#82261e',
+ 35: '#8c372c',
+ 40: '#96463b',
+ 45: '#a0564a',
+ 50: '#a96559',
+ 55: '#b77265',
+ 60: '#c57e72',
+ 65: '#d48b7e',
+ 70: '#e2998b',
+ 75: '#f1a698',
+ 80: '#ffb4a6',
+ 85: '#ffc7bc',
+ 90: '#ffdad2',
+ 95: '#ffece8',
+ 100: '#ffffff',
+ },
+ warning: {
+ 0: '#000000',
+ 5: '#270c00',
+ 10: '#301800',
+ 15: '#3b2200',
+ 20: '#472c00',
+ 25: '#543700',
+ 30: '#614200',
+ 35: '#6f4d00',
+ 40: '#7d5800',
+ 45: '#8b6400',
+ 50: '#9a7000',
+ 55: '#a97d00',
+ 60: '#b88900',
+ 65: '#c89600',
+ 70: '#d8a300',
+ 75: '#e7b100',
+ 80: '#f7be00',
+ 85: '#ffcd51',
+ 90: '#ffde9c',
+ 95: '#ffeed0',
+ 100: '#ffffff',
+ },
+ success: {
+ 0: '#000000',
+ 5: '#001a00',
+ 10: '#092300',
+ 15: '#0b2e00',
+ 20: '#043b00',
+ 25: '#004700',
+ 30: '#005400',
+ 35: '#036100',
+ 40: '#136e00',
+ 45: '#277b00',
+ 50: '#448700',
+ 55: '#529400',
+ 60: '#60a105',
+ 65: '#6eaf1d',
+ 70: '#7cbd2e',
+ 75: '#8bcb3c',
+ 80: '#99d94b',
+ 85: '#a7e758',
+ 90: '#b5f566',
+ 95: '#ccff88',
+ 100: '#ffffff',
+ },
+} as const;
diff --git a/packages/themes/butter/src/icons.tsx b/packages/themes/butter/src/icons.tsx
new file mode 100644
index 0000000000..f60572b98b
--- /dev/null
+++ b/packages/themes/butter/src/icons.tsx
@@ -0,0 +1,76 @@
+/**
+ * @file icons.tsx
+ * @input Uses lucide-react icon components, XDSIconRegistry type
+ * @output Exports butterIconRegistry for the butter theme
+ * @position Icon configuration for the butter theme; consumed by index.ts
+ *
+ * Maps semantic icon names to Lucide icon components.
+ * These icons are bundled with the theme, not with @xds/core.
+ */
+
+import React from 'react';
+import type {XDSIconRegistry} from '@xds/core/Icon';
+
+import {
+ X,
+ ChevronDown,
+ ChevronLeft,
+ ChevronRight,
+ Check,
+ CheckCircle,
+ XCircle,
+ AlertTriangle,
+ Info,
+ Calendar,
+ Clock,
+ ExternalLink,
+ Menu,
+ MoreHorizontal,
+ Search,
+ ArrowUp,
+ ArrowDown,
+ ArrowUpDown,
+ Filter,
+ EyeOff,
+ Columns,
+ Copy,
+ CheckCheck,
+ Wrench,
+ Square,
+ Mic,
+ CircleDot,
+} from 'lucide-react';
+
+const iconProps = {
+ size: '1em',
+ 'aria-hidden': true as const,
+};
+
+export const butterIconRegistry: XDSIconRegistry = {
+ close: <X {...iconProps} />,
+ chevronDown: <ChevronDown {...iconProps} />,
+ chevronLeft: <ChevronLeft {...iconProps} />,
+ chevronRight: <ChevronRight {...iconProps} />,
+ check: <Check {...iconProps} />,
+ success: <CheckCircle {...iconProps} />,
+ error: <XCircle {...iconProps} />,
+ warning: <AlertTriangle {...iconProps} />,
+ info: <Info {...iconProps} />,
+ calendar: <Calendar {...iconProps} />,
+ clock: <Clock {...iconProps} />,
+ externalLink: <ExternalLink {...iconProps} />,
+ menu: <Menu {...iconProps} />,
+ moreHorizontal: <MoreHorizontal {...iconProps} />,
+ search: <Search {...iconProps} />,
+ arrowUp: <ArrowUp {...iconProps} />,
+ arrowDown: <ArrowDown {...iconProps} />,
+ arrowsUpDown: <ArrowUpDown {...iconProps} />,
+ funnel: <Filter {...iconProps} />,
+ eyeSlash: <EyeOff {...iconProps} />,
+ viewColumns: <Columns {...iconProps} />,
+ copy: <Copy {...iconProps} />,
+ checkDouble: <CheckCheck {...iconProps} />,
+ wrench: <Wrench {...iconProps} />,
+ stop: <Square {...iconProps} />,
+ microphone: <Mic {...iconProps} />,
+};
diff --git a/packages/themes/butter/src/source.ts b/packages/themes/butter/src/source.ts
new file mode 100644
index 0000000000..5b4548f6c8
--- /dev/null
+++ b/packages/themes/butter/src/source.ts
@@ -0,0 +1,2 @@
+export {butterTheme, butterPalettes} from './butterTheme';
+export {butterIconRegistry} from './icons';
diff --git a/packages/themes/butter/theme.css.d.ts b/packages/themes/butter/theme.css.d.ts
new file mode 100644
index 0000000000..cb0ff5c3b5
--- /dev/null
+++ b/packages/themes/butter/theme.css.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/packages/themes/butter/tsconfig.build.json b/packages/themes/butter/tsconfig.build.json
new file mode 100644
index 0000000000..03d4647cd5
--- /dev/null
+++ b/packages/themes/butter/tsconfig.build.json
@@ -0,0 +1,13 @@
+{
+ "extends": "../../../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "noEmit": false,
+ "declaration": true,
+ "emitDeclarationOnly": true
+ },
+ "include": [
+ "src"
+ ]
+}
diff --git a/packages/themes/butter/tsup.config.ts b/packages/themes/butter/tsup.config.ts
new file mode 100644
index 0000000000..c503745454
--- /dev/null
+++ b/packages/themes/butter/tsup.config.ts
@@ -0,0 +1,9 @@
+import {defineConfig} from 'tsup';
+
+export default defineConfig({
+ entry: ['src/source.ts', 'src/icons.tsx'],
+ format: ['cjs', 'esm'],
+ dts: false,
+ clean: false, // Don't clean — xds theme build already put theme files in dist/
+ external: ['@xds/core', 'react', 'lucide-react'],
+});