An open source design system that's fully customizable and agent ready
TypeScript
Add Matcha theme — earthy green palette with Figtree typography (#1803)
rubyycheungc8c0f5210a37
diff --git a/package.json b/package.jsonindex 432bbd7cb0..f2b42ca664 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-whatsapp build && yarn workspace @xds/theme-meta 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-whatsapp build && yarn workspace @xds/theme-meta build && yarn workspace @xds/theme-matcha build","dev": "yarn workspace @xds/storybook dev","test": "vitest run","test:watch": "vitest",diff --git a/packages/themes/matcha/README.md b/packages/themes/matcha/README.mdnew file mode 100644index 0000000000..72f65d1800--- /dev/null+++ b/packages/themes/matcha/README.md@@ -0,0 +1,44 @@+# @xds/theme-matcha++Earthy green theme with Figtree typography. Uses [Lucide](https://lucide.dev) icons.++## Install++```bash+npm install @xds/theme-matcha+```++## Usage++Wrap your app with `XDSTheme` and pass the theme:++```tsx+import {XDSTheme} from '@xds/core/theme';+import {matchaTheme} from '@xds/theme-matcha/built';++function App() {+ return (+ <XDSTheme theme={matchaTheme}>+ {/* your app */}+ </XDSTheme>+ );+}+```++### Import paths++| Path | Use case |+|------|----------|+| `@xds/theme-matcha` | Source build (StyleX compilation via `@xds/build`) |+| `@xds/theme-matcha/built` | Pre-built dist (Tailwind, plain CSS, or no build step) |+| `@xds/theme-matcha/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-matcha/theme.css";+```diff --git a/packages/themes/matcha/package.json b/packages/themes/matcha/package.jsonnew file mode 100644index 0000000000..83dfa8f1c0--- /dev/null+++ b/packages/themes/matcha/package.json@@ -0,0 +1,61 @@+{+ "name": "@xds/theme-matcha",+ "version": "0.0.1",+ "private": false,+ "description": "Matcha theme for XDS — earthy green palette with Figtree typography 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/matcha"+ },+ "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/matcha.d.ts",+ "import": "./dist/matcha.js",+ "require": "./dist/matcha.js"+ },+ "./theme.css": {+ "types": "./theme.css.d.ts",+ "default": "./dist/theme.css"+ }+ },+ "files": [+ "dist",+ "src"+ ],+ "scripts": {+ "build": "xds theme build src/matchaTheme.ts -o dist/theme.css && tsup && tsc --project tsconfig.build.json"+ },+ "dependencies": {+ "lucide-react": "^1.11.0"+ },+ "peerDependencies": {+ "@xds/core": "*",+ "react": ">=19"+ },+ "devDependencies": {+ "@xds/cli": "*"+ },+ "module": "./dist/source.mjs"+}diff --git a/packages/themes/matcha/src/icons.tsx b/packages/themes/matcha/src/icons.tsxnew file mode 100644index 0000000000..eab8f6d831--- /dev/null+++ b/packages/themes/matcha/src/icons.tsx@@ -0,0 +1,66 @@+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 matchaIconRegistry: 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/matcha/src/matchaTheme.ts b/packages/themes/matcha/src/matchaTheme.tsnew file mode 100644index 0000000000..0795af2b7d--- /dev/null+++ b/packages/themes/matcha/src/matchaTheme.ts@@ -0,0 +1,84 @@+import {defineTheme} from '@xds/core/theme';+import {matchaIconRegistry} from './icons';++export const matchaTheme = defineTheme({+ name: 'matcha',+ typography: {scale: {base: 18, ratio: 1.414}},+ tokens: {+ '--color-accent': '#6E8764',+ '--color-accent-muted': ['#414C3033', '#7FDA9740'],+ '--color-on-accent': ['#FFFFFF', '#003C06'],+ '--color-neutral': ['#171D181A', '#DCE5DD33'],+ '--color-background-surface': ['#FFFFFF', '#171D18'],+ '--color-background-body': ['#F9F6EF', '#0A130C'],+ '--color-overlay': ['#171D1866', '#171D1899'],+ '--color-overlay-hover': ['#171D180D', '#FFFFFF0D'],+ '--color-overlay-pressed': ['#171D181A', '#FFFFFF1A'],+ '--color-background-muted': ['#171D180D', '#171D1880'],+ '--color-text-primary': ['#171D18', '#DCE5DD'],+ '--color-text-secondary': ['#3E4A40', '#A1AFA4'],+ '--color-text-disabled': ['#879489', '#556157'],+ '--color-text-accent': ['#00541E', '#7FDA97'],+ '--color-icon-accent': ['#006D34', '#7FDA97'],+ '--color-icon-primary': ['#171D18', '#DCE5DD'],+ '--color-icon-secondary': ['#3E4A40', '#A1AFA4'],+ '--color-icon-disabled': ['#879489', '#556157'],+ '--color-background-card': ['#F9F6EF', '#171D18'],+ '--color-background-popover': ['#F9F6EF', '#2B322C'],+ '--color-background-inverted': ['#171D18', '#F5FFF7'],+ '--color-border': ['#171D181A', '#EAF3EC1A'],+ '--color-border-emphasized': ['#A1AFA4', '#3E4A40'],+ '--color-skeleton': ['#A1AFA4', '#3E4A40'],+ '--color-shadow': ['#0000001A', '#0000004D'],+ '--spacing-0-5': '3px',+ '--spacing-1': '6px',+ '--spacing-1-5': '9px',+ '--spacing-2': '12px',+ '--spacing-3': '18px',+ '--spacing-4': '24px',+ '--spacing-5': '30px',+ '--spacing-6': '36px',+ '--spacing-7': '42px',+ '--spacing-8': '48px',+ '--spacing-9': '54px',+ '--spacing-10': '60px',+ '--spacing-11': '66px',+ '--spacing-12': '72px',+ '--radius-inner': '6px',+ '--radius-element': '12px',+ '--radius-container': '18px',+ '--radius-page': '42px',+ '--font-family-body':+ '"Figtree", -apple-system, sans-serif',+ '--font-family-heading':+ '"Figtree", -apple-system, sans-serif',+ '--font-size-4xs': '0.1875rem',+ '--font-size-3xs': '0.3125rem',+ '--font-size-2xs': '0.375rem',+ '--font-size-xs': '0.5625rem',+ '--font-size-sm': '0.8125rem',+ '--font-size-base': '1.125rem',+ '--font-size-lg': '1.5625rem',+ '--font-size-xl': '2.25rem',+ '--font-size-2xl': '3.1875rem',+ '--font-size-3xl': '4.5rem',+ '--font-size-4xl': '6.375rem',+ '--font-size-5xl': '9rem',+ '--size-element-sm': '36px',+ '--size-element-md': '40px',+ '--size-element-lg': '44px',+ },+ components: {+ button: {+ base: {+ borderRadius: 'var(--radius-full)',+ },+ },+ card: {+ base: {+ borderRadius: 'var(--radius-page)',+ },+ },+ },+ icons: matchaIconRegistry,+});diff --git a/packages/themes/matcha/src/source.ts b/packages/themes/matcha/src/source.tsnew file mode 100644index 0000000000..bcd66a78c9--- /dev/null+++ b/packages/themes/matcha/src/source.ts@@ -0,0 +1,2 @@+export {matchaTheme} from './matchaTheme';+export {matchaIconRegistry} from './icons';diff --git a/packages/themes/matcha/theme.css.d.ts b/packages/themes/matcha/theme.css.d.tsnew file mode 100644index 0000000000..cb0ff5c3b5--- /dev/null+++ b/packages/themes/matcha/theme.css.d.ts@@ -0,0 +1 @@+export {};diff --git a/packages/themes/matcha/tsconfig.build.json b/packages/themes/matcha/tsconfig.build.jsonnew file mode 100644index 0000000000..03d4647cd5--- /dev/null+++ b/packages/themes/matcha/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/matcha/tsup.config.ts b/packages/themes/matcha/tsup.config.tsnew file mode 100644index 0000000000..c503745454--- /dev/null+++ b/packages/themes/matcha/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'],+});