Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(settings): add import theme from clipboard and document theme mentions (#8186)

Jacob Beckerman6d26d52d9a0a
diff --git a/apps/web/src/features/settings/Appearance.tsx b/apps/web/src/features/settings/Appearance.tsx
index de342547db..4d4991d686 100644
--- a/apps/web/src/features/settings/Appearance.tsx
+++ b/apps/web/src/features/settings/Appearance.tsx
@@ -2,6 +2,7 @@ import { toast } from '@core/component/Toast/Toast';
import { fireAndForget } from '@core/util/fireAndForget';
import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu';
import ClipboardIcon from '@phosphor/clipboard.svg';
+import DownloadIcon from '@phosphor/download-simple.svg';
import PencilIcon from '@phosphor/pencil-simple.svg';
import PlusIcon from '@phosphor/plus.svg';
import TrashIcon from '@phosphor/trash.svg';
@@ -28,6 +29,7 @@ import {
deleteTheme,
exportTheme,
getLiveTheme,
+ importThemeFromClipboard,
previewTheme,
resolveActiveThemeId,
saveTheme,
@@ -444,6 +446,16 @@ function InterfaceThemeSelect(props: {
New theme
</span>
</Dropdown.Item>
+ <Dropdown.Item
+ class="touch:min-h-10"
+ onSelect={() => importThemeFromClipboard()}
+ onFocus={clearThemePreview}
+ >
+ <span class="flex items-center gap-2 text-ink-muted">
+ <DownloadIcon class="size-4" />
+ Import from clipboard
+ </span>
+ </Dropdown.Item>
</Dropdown.Group>
</Layer>
</Dropdown.Content>
diff --git a/apps/web/src/features/theme/utils/themeUtils.ts b/apps/web/src/features/theme/utils/themeUtils.ts
index 606ccb87a7..fd5bb338a4 100644
--- a/apps/web/src/features/theme/utils/themeUtils.ts
+++ b/apps/web/src/features/theme/utils/themeUtils.ts
@@ -47,7 +47,8 @@ export async function exportTheme(themeId?: string): Promise<void> {
}
}
-async function _importTheme(): Promise<void> {
+/** Imports a theme from the clipboard JSON and applies it. */
+export async function importThemeFromClipboard(): Promise<void> {
try {
const text = await navigator.clipboard.readText();
const parsed: unknown = JSON.parse(text);
@@ -73,6 +74,7 @@ async function _importTheme(): Promise<void> {
};
setUserThemes([...userThemes(), newTheme]);
applyTheme(id);
+ toast.success(`Imported theme "${imported.name}"`);
} catch (e) {
console.error('Failed to import theme:', e);
toast.alert('Failed to import theme from clipboard.');
diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.md
index b0627652c4..a71abb2e51 100644
--- a/docs/agent-guide/ai-chat.md
+++ b/docs/agent-guide/ai-chat.md
@@ -1093,7 +1093,8 @@ delete controls. **New skill** creates a skill and inserts its mention. Type `@`
used in chat and channels; they serialize as mention-chip tags in the prompt
the agent sees (`<m-document-mention>` for docs/channels/chats/tasks/emails/calendar
events/skills, `<m-date-mention>` for a day or time, `<m-agent-session-mention>`
-for an agent session, `<m-user-mention>` for a person, and the other chip tags).
+for an agent session, `<m-user-mention>` for a person, `<m-theme-mention>` for a
+clickable color theme, and the other chip tags).
Clicking a chip while it still sits in the composer (Home, the Agents page, or
an agent session) opens the mentioned item in a new split and leaves the draft
and caret untouched; it does not send anything.
diff --git a/docs/agent-guide/settings.md b/docs/agent-guide/settings.md
index c267974247..a291ff7e5f 100644
--- a/docs/agent-guide/settings.md
+++ b/docs/agent-guide/settings.md
@@ -231,7 +231,44 @@ preview** for the visual key map.
Appearance starts with visual **System**, **Light**, and **Dark** mode choices.
The previews use the saved themes; System follows the device and exposes both
per-mode theme selectors. Light or Dark shows its own theme selector. Each selector
-retains theme search, editing, copying, and custom theme creation.
+retains theme search, editing, copying, custom theme creation, and importing
+themes from the clipboard.
+
+### Theme mentions
+
+Agent replies can include clickable theme mentions that let users apply a theme
+with one click. The format is:
+
+```
+<m-theme-mention>{"name":"Theme Name","data":{...theme object...}}</m-theme-mention>
+```
+
+The `data` field must be a valid ThemeV3 object with these required fields:
+- `id`: a UUID string (generate a new one for each theme)
+- `name`: the display name
+- `version`: must be `3`
+- `mode`: `"light"` or `"dark"`
+- `colorTokens`: an object with OKLCH color values for these required tokens:
+ `surface-0` through `surface-4`, `content-0` through `content-4`, `edge`,
+ `edge-muted`, `accent`, and the palette colors (`red`, `orange`, `amber`,
+ `yellow`, `lime`, `green`, `teal`, `cyan`, `blue`, `violet`, `purple`, `pink`).
+
+Example of a complete theme mention:
+```
+<m-theme-mention>{"name":"Ocean Dark","data":{"id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","name":"Ocean Dark","version":3,"mode":"dark","colorTokens":{"surface-0":"oklch(0.15 0.02 230)","surface-1":"oklch(0.18 0.02 230)","surface-2":"oklch(0.21 0.02 230)","surface-3":"oklch(0.24 0.02 230)","surface-4":"oklch(0.27 0.02 230)","content-0":"oklch(0.95 0.01 230)","content-1":"oklch(0.85 0.01 230)","content-2":"oklch(0.70 0.01 230)","content-3":"oklch(0.55 0.01 230)","content-4":"oklch(0.40 0.01 230)","edge":"oklch(0.35 0.02 230)","edge-muted":"oklch(0.25 0.02 230)","accent":"oklch(0.65 0.15 220)","red":"oklch(0.65 0.2 25)","orange":"oklch(0.7 0.18 50)","amber":"oklch(0.75 0.16 75)","yellow":"oklch(0.85 0.15 95)","lime":"oklch(0.8 0.18 125)","green":"oklch(0.7 0.17 145)","teal":"oklch(0.7 0.12 175)","cyan":"oklch(0.75 0.12 200)","blue":"oklch(0.65 0.15 230)","violet":"oklch(0.6 0.18 280)","purple":"oklch(0.6 0.2 300)","pink":"oklch(0.7 0.18 340)"}}}</m-theme-mention>
+```
+
+When clicked, the theme is added to the user's custom themes (if not already
+present) and immediately applied, then Settings opens to Appearance. The theme
+chip renders inline with the theme's color swatches beside the name.
+
+### Importing themes
+
+**Import from clipboard** in the theme dropdown reads a theme JSON from the
+clipboard. Valid ThemeV3 (or legacy ThemeV2) JSON is imported as a custom theme
+and applied immediately. Copy a theme with the clipboard button beside any
+theme pill, then import it on another device or share it in a message for
+others to copy and import.
Existing settings URLs remain valid; `connections` still opens Integrations,
`agent-connections` opens Agent connections, and `harness` aliases Runtimes.