Skip to content

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

TypeScript

feat(theme): add Chocolate theme (#2026)

rubyycheunge070ec9def8a
diff --git a/package.json b/package.json
index 3e629b7d5c..58c0a86b75 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",
+ "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",
"dev": "yarn workspace @xds/storybook dev",
"test": "vitest run",
"test:watch": "vitest",
diff --git a/packages/themes/chocolate/README.md b/packages/themes/chocolate/README.md
new file mode 100644
index 0000000000..2efa0ddf12
--- /dev/null
+++ b/packages/themes/chocolate/README.md
@@ -0,0 +1,44 @@
+# @xds/theme-chocolate
+
+Warm chocolate theme with rich brown tones and cozy beige backgrounds. Uses Fraunces for headings, Albert Sans for body text, and [Lucide](https://lucide.dev) icons.
+
+## Install
+
+```bash
+npm install @xds/theme-chocolate
+```
+
+## Usage
+
+Wrap your app with `XDSTheme` and pass the theme:
+
+```tsx
+import {XDSTheme} from '@xds/core/theme';
+import {chocolateTheme} from '@xds/theme-chocolate/built';
+
+function App() {
+ return (
+ <XDSTheme theme={chocolateTheme}>
+ {/* your app */}
+ </XDSTheme>
+ );
+}
+```
+
+### Import paths
+
+| Path | Use case |
+|------|----------|
+| `@xds/theme-chocolate` | Source build (StyleX compilation via `@xds/build`) |
+| `@xds/theme-chocolate/built` | Pre-built dist (Tailwind, plain CSS, or no build step) |
+| `@xds/theme-chocolate/theme.css` | Pre-built CSS file (import in your stylesheet) |
+
+If you're using `@xds/build` for StyleX source compilation, import from the bare path. Otherwise, use `/built`.
+
+### CSS import
+
+Add the theme CSS to your stylesheet:
+
+```css
+@import "@xds/theme-chocolate/theme.css";
+```
diff --git a/packages/themes/chocolate/package.json b/packages/themes/chocolate/package.json
new file mode 100644
index 0000000000..b7159c01b1
--- /dev/null
+++ b/packages/themes/chocolate/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "@xds/theme-chocolate",
+ "version": "0.0.13",
+ "displayName": "Chocolate Theme",
+ "private": false,
+ "description": "Warm chocolate theme for XDS \u2014 rich brown palette with Fraunces headings, Albert Sans body, and Lucide icons",
+ "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/chocolate"
+ },
+ "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/chocolate.d.ts",
+ "import": "./dist/chocolate.js",
+ "require": "./dist/chocolate.js"
+ },
+ "./theme.css": {
+ "types": "./theme.css.d.ts",
+ "default": "./dist/theme.css"
+ }
+ },
+ "files": [
+ "dist",
+ "src"
+ ],
+ "scripts": {
+ "build": "xds theme build src/chocolateTheme.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/chocolate/src/chocolateTheme.ts b/packages/themes/chocolate/src/chocolateTheme.ts
new file mode 100644
index 0000000000..392560b31c
--- /dev/null
+++ b/packages/themes/chocolate/src/chocolateTheme.ts
@@ -0,0 +1,228 @@
+/**
+ * Chocolate Theme
+ *
+ * A warm, cozy theme inspired by rich chocolate and caramel tones.
+ * Core palette: #8C5927, #B88859, #C4AC95, #EDE4D4, #FFFCF7
+ * Uses Fraunces for headings and Albert Sans for body text.
+ */
+
+import {defineTheme, defineSyntaxTheme} from '@xds/core/theme';
+import {chocolateIconRegistry} from './icons';
+
+/** Chocolate syntax palette — warm browns and amber tones. */
+const chocolateSyntax = defineSyntaxTheme({
+ name: 'xds-chocolate',
+ tokens: {
+ keyword: ['#8C5927', '#d4a06a'],
+ string: ['#2e6b4a', '#7bc49e'],
+ comment: ['#B88859', '#B88859'],
+ number: ['#a06018', '#d4b870'],
+ function: ['#3a5e8c', '#7ba8d4'],
+ type: ['#6b4a8c', '#b08ed4'],
+ variable: ['#4a3520', '#EDE4D4'],
+ operator: ['#B88859', '#c4a882'],
+ constant: ['#a06018', '#d4b870'],
+ tag: ['#8c3a3a', '#d47a7a'],
+ attribute: ['#8C5927', '#d4a06a'],
+ property: ['#3a7c6b', '#70c4b0'],
+ punctuation: ['#B88859', '#6b5540'],
+ background: ['#FFFCF7', '#1c1610'],
+ },
+});
+
+export const chocolateTheme = defineTheme({
+ name: 'chocolate',
+
+ typography: {
+ scale: {base: 14, ratio: 1.2},
+ body: {
+ family: 'Albert Sans',
+ fallbacks:
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
+ },
+ heading: {
+ family: 'Fraunces',
+ fallbacks:
+ 'Georgia, "Times New Roman", Times, 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: chocolateSyntax,
+
+ tokens: {
+ // =========================================================================
+ // Colors — warm chocolate palette
+ // Core: #8C5927, #B88859, #C4AC95, #EDE4D4, #FFFCF7
+ // =========================================================================
+
+ // Core semantic
+ '--color-accent': ['#8C5927', '#d4a06a'],
+ '--color-accent-muted': ['#8C592714', '#d4a06a20'],
+ '--color-neutral': ['#8C59270F', '#EDE4D41A'],
+ '--color-background-surface': ['#FFFCF7', '#1c1610'],
+ '--color-background-body': ['#FFFCF7', '#141010'],
+ '--color-overlay': ['#4a352080', '#140e0aCC'],
+ '--color-overlay-hover': ['#4a35200D', '#EDE4D40D'],
+ '--color-overlay-pressed': ['#4a35201A', '#EDE4D41A'],
+ '--color-background-muted': ['#EDE4D4', '#2a2018'],
+
+ // Text
+ '--color-text-primary': ['#4a3520', '#EDE4D4'],
+ '--color-text-secondary': ['#B88859', '#c4a882'],
+ '--color-text-disabled': ['#C4AC95', '#6b5540'],
+ '--color-text-accent': ['#8C5927', '#d4a06a'],
+ '--color-on-dark': '#FFFCF7',
+ '--color-on-light': '#4a3520',
+ '--color-on-accent': ['#FFFFFF', '#4a3520'],
+ '--color-on-success': ['#FFFFFF', '#4a3520'],
+ '--color-on-error': ['#FFFFFF', '#4a3520'],
+ '--color-on-warning': ['#4a3520', '#4a3520'],
+
+ // Icon
+ '--color-icon-accent': ['#8C5927', '#d4a06a'],
+ '--color-icon-primary': ['#4a3520', '#EDE4D4'],
+ '--color-icon-secondary': ['#B88859', '#c4a882'],
+ '--color-icon-disabled': ['#C4AC95', '#6b5540'],
+
+ // Surface variants
+ '--color-background-card': ['#EDE4D4', '#2a2018'],
+ '--color-background-popover': ['#FFFCF7', '#2a2018'],
+ '--color-background-inverted': ['#4a3520', '#EDE4D4'],
+
+ // Status / Sentiment
+ '--color-success': ['#709900', '#96bf2a'],
+ '--color-success-muted': ['#70990020', '#96bf2a20'],
+ '--color-error': ['#FD0000', '#ff5c5c'],
+ '--color-error-muted': ['#FD000020', '#ff5c5c20'],
+ '--color-warning': ['#FFB600', '#ffc940'],
+ '--color-warning-muted': ['#FFB60020', '#ffc94020'],
+
+ // Border
+ '--color-border': ['#C4AC95', '#EDE4D41A'],
+ '--color-border-emphasized': ['#B88859', '#6b5540'],
+
+ // Effects
+ '--color-skeleton': ['#C4AC95', '#6b5540'],
+ '--color-shadow': ['#4a35201A', '#0000004D'],
+ '--color-tint-hover': ['black', 'white'],
+
+ // Categorical — Blue
+ '--color-background-blue': ['#3a5e8c33', '#3a5e8c33'],
+ '--color-border-blue': ['#3a5e8c', '#7ba8d4'],
+ '--color-icon-blue': ['#3a5e8c', '#7ba8d4'],
+ '--color-text-blue': ['#2e4a6e', '#8dbce0'],
+
+ // Categorical — Cyan
+ '--color-background-cyan': ['#3a7c7c33', '#3a7c7c33'],
+ '--color-border-cyan': ['#3a7c7c', '#70c4c4'],
+ '--color-icon-cyan': ['#3a7c7c', '#70c4c4'],
+ '--color-text-cyan': ['#2e6060', '#82d4d4'],
+
+ // Categorical — Gray
+ '--color-background-gray': ['#B8885933', '#6b554033'],
+ '--color-border-gray': ['#B88859', '#B88859'],
+ '--color-icon-gray': ['#B88859', '#c4a882'],
+ '--color-text-gray': ['#4a3520', '#EDE4D4'],
+
+ // Categorical — Green
+ '--color-background-green': ['#70990033', '#96bf2a33'],
+ '--color-border-green': ['#709900', '#96bf2a'],
+ '--color-icon-green': ['#709900', '#96bf2a'],
+ '--color-text-green': ['#5a7a00', '#a8d43a'],
+
+ // Categorical — Orange
+ '--color-background-orange': ['#c4762033', '#d4903a33'],
+ '--color-border-orange': ['#c47620', '#d4903a'],
+ '--color-icon-orange': ['#c47620', '#d4903a'],
+ '--color-text-orange': ['#a06018', '#e0a04a'],
+
+ // Categorical — Pink
+ '--color-background-pink': ['#c44a7033', '#e07a9a33'],
+ '--color-border-pink': ['#c44a70', '#e07a9a'],
+ '--color-icon-pink': ['#c44a70', '#e07a9a'],
+ '--color-text-pink': ['#a03a5a', '#f08aaa'],
+
+ // Categorical — Purple
+ '--color-background-purple': ['#6b4a8c33', '#b08ed433'],
+ '--color-border-purple': ['#6b4a8c', '#b08ed4'],
+ '--color-icon-purple': ['#6b4a8c', '#b08ed4'],
+ '--color-text-purple': ['#553a70', '#c0a0e0'],
+
+ // Categorical — Red
+ '--color-background-red': ['#FD000033', '#ff5c5c33'],
+ '--color-border-red': ['#FD0000', '#ff5c5c'],
+ '--color-icon-red': ['#FD0000', '#ff5c5c'],
+ '--color-text-red': ['#cc0000', '#ff7a7a'],
+
+ // Categorical — Teal
+ '--color-background-teal': ['#2e6b5a33', '#5ab89833'],
+ '--color-border-teal': ['#2e6b5a', '#5ab898'],
+ '--color-icon-teal': ['#2e6b5a', '#5ab898'],
+ '--color-text-teal': ['#245546', '#6ccaaa'],
+
+ // Categorical — Yellow
+ '--color-background-yellow': ['#FFB60033', '#ffc94033'],
+ '--color-border-yellow': ['#FFB600', '#ffc940'],
+ '--color-icon-yellow': ['#FFB600', '#ffc940'],
+ '--color-text-yellow': ['#cc9200', '#ffd960'],
+
+ // =========================================================================
+ // Radius — soft and rounded
+ // =========================================================================
+ '--radius-none': '0.125rem',
+ '--radius-inner': '0.375rem',
+ '--radius-element': '0.625rem',
+ '--radius-container': '0.75rem',
+ '--radius-page': '1.5rem',
+ '--radius-full': '9999px',
+
+ // =========================================================================
+ // Shadows — warm-toned
+ // =========================================================================
+ '--shadow-low':
+ '0 2px 4px #4a35200D, 0 4px 8px #4a35201A',
+ '--shadow-med':
+ '0 2px 4px #4a35200D, 0 4px 12px #4a35201A',
+ '--shadow-high':
+ '0 4px 6px #4a35201A, 0 12px 24px #4a352026',
+ '--shadow-inset-hover': 'inset 0px 0px 0px 2px #8C592730',
+ '--shadow-inset-selected': 'inset 0px 0px 0px 2px #8C592750',
+ '--shadow-inset-success': 'inset 0px 0px 0px 2px #70990050',
+ '--shadow-inset-warning': 'inset 0px 0px 0px 2px #FFB60050',
+ '--shadow-inset-error': 'inset 0px 0px 0px 2px #FD000050',
+ },
+
+ components: {
+ button: {
+ base: {
+ borderRadius: 'var(--radius-full)',
+ },
+ 'variant:secondary': {
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: 'var(--color-border-emphasized)',
+ },
+ },
+
+ card: {
+ base: {
+ padding: 'var(--spacing-3)',
+ },
+ },
+
+ section: {
+ base: {
+ padding: 'var(--spacing-3)',
+ },
+ },
+ },
+
+ icons: chocolateIconRegistry,
+});
diff --git a/packages/themes/chocolate/src/icons.tsx b/packages/themes/chocolate/src/icons.tsx
new file mode 100644
index 0000000000..340fc730f2
--- /dev/null
+++ b/packages/themes/chocolate/src/icons.tsx
@@ -0,0 +1,76 @@
+/**
+ * @file icons.tsx
+ * @input Uses lucide-react icon components, XDSIconRegistry type
+ * @output Exports chocolateIconRegistry for the neutral theme
+ * @position Icon configuration for the neutral 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 chocolateIconRegistry: 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/chocolate/src/source.ts b/packages/themes/chocolate/src/source.ts
new file mode 100644
index 0000000000..50bc456cf0
--- /dev/null
+++ b/packages/themes/chocolate/src/source.ts
@@ -0,0 +1,2 @@
+export {chocolateTheme} from './chocolateTheme';
+export {chocolateIconRegistry} from './icons';
diff --git a/packages/themes/chocolate/theme.css.d.ts b/packages/themes/chocolate/theme.css.d.ts
new file mode 100644
index 0000000000..cb0ff5c3b5
--- /dev/null
+++ b/packages/themes/chocolate/theme.css.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/packages/themes/chocolate/tsconfig.build.json b/packages/themes/chocolate/tsconfig.build.json
new file mode 100644
index 0000000000..1c9f13c70e
--- /dev/null
+++ b/packages/themes/chocolate/tsconfig.build.json
@@ -0,0 +1,11 @@
+{
+ "extends": "../../../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "noEmit": false,
+ "declaration": true,
+ "emitDeclarationOnly": true
+ },
+ "include": ["src"]
+}
diff --git a/packages/themes/chocolate/tsup.config.ts b/packages/themes/chocolate/tsup.config.ts
new file mode 100644
index 0000000000..c503745454
--- /dev/null
+++ b/packages/themes/chocolate/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'],
+});