@devries-cameron20 / t3code-1 / commits / 49f51e1c3c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): allow adding the displayed provider accent color (#25014)

Co-authored-by: tsukaska <16710830+tsukaska@users.noreply.github.com> Co-authored-by: maria-rcks <maria@kuuro.net>

tsukaska committed Oct 30, 2026 at 15:09 UTC 49f51e1c3c97461c995c79a634c564a680257d51
3 files changed +133 -2
apps/web/src/components/settings/AddProviderInstanceDialog.environment.browser.test.tsx
+20
@@ -170,6 +170,26 @@ describe("AddProviderInstanceDialog environment routing", () => {
170 });
171 });
172
173 + it("includes the explicitly added default accent color when creating a provider", async () => {
174 + setup();
175 + await using _screen = await render(dialog());
176 + await click("Show more");
177 + await click("Use Kilo Code");
178 + await act(async () =>
179 + document
180 + .querySelector<HTMLButtonElement>('button[aria-label="Add accent color for Kilo Code"]')!
181 + .click(),
182 + );
183 + await click("Add color");
184 + await click("Continue to sign-in");
185 +
186 + expect(settingsHooks.mutate).toHaveBeenCalledWith({
187 + operation: "create",
188 + instanceId: "acpRegistry_kilo_code",
189 + instance: expect.objectContaining({ accentColor: "#2563eb" }),
190 + });
191 + });
192 +
193 it("keeps fx and the ACP Registry under Show more", async () => {
194 setup();
195 await using _screen = await render(dialog());
apps/web/src/components/settings/ProviderAccentColorPicker.tsx
+19
@@ -14,11 +14,20 @@ function ProviderCustomColorPanel(props: {
14 readonly value: string;
15 readonly onPreview: (value: string) => void;
16 readonly onCommit: (value: string) => void;
17 + readonly showAddButton: boolean;
18 }) {
19 const { onCommit, onPreview } = props;
20 const [hsv, setHsv] = useState(() => hexToHsv(props.value));
21 const currentColor = hsvToHex(hsv.h, hsv.s, hsv.v);
22 const [hexDraft, setHexDraft] = useState<string | null>(null);
23 + const [syncedValue, setSyncedValue] = useState(props.value);
24 + if (syncedValue !== props.value) {
25 + setSyncedValue(props.value);
26 + if (currentColor !== props.value.toLowerCase()) {
27 + setHsv(hexToHsv(props.value));
28 + setHexDraft(null);
29 + }
30 + }
31 // Pointer drags only preview and commit once on release, so a drag writes
32 // settings once instead of on every pointer move. Keyboard steps commit
33 // immediately because they have no release to wait for. Holds the latest
@@ -80,6 +89,15 @@ function ProviderCustomColorPanel(props: {
89 aria-label="Custom hex accent color"
90 spellCheck={false}
91 />
92 + {props.showAddButton ? (
93 + <PopoverClose
94 + render={
95 + <Button type="button" size="compact" onClick={() => onCommit(currentColor)}>
96 + Add color
97 + </Button>
98 + }
99 + />
100 + ) : null}
101 </div>
102 </div>
103 );
@@ -123,6 +141,7 @@ function ProviderCustomColorPicker(props: {
141 value={normalized ?? FALLBACK_ACCENT_COLOR}
142 onPreview={props.onPreview}
143 onCommit={props.onCommit}
144 + showAddButton={!normalized}
145 />
146 {normalized ? (
147 <div className="border-t border-border/60 p-1">
apps/web/src/components/settings/colorPickers.browser.test.tsx
+94 -2
@@ -1,5 +1,5 @@
1 import { describe, expect, it, vi } from "vite-plus/test";
2 -import { userEvent } from "vite-plus/test/browser";
2 +import { page, userEvent } from "vite-plus/test/browser";
3
4 import { useState, type ReactNode } from "react";
5
@@ -124,6 +124,89 @@ async function renderAccentPicker(value: string) {
124 }
125
126 describe("provider accent color picker", () => {
127 + it("leaves the optional color unset when the preview is dismissed", async () => {
128 + const onCommit = vi.fn();
129 + await using _screen = await renderPicker(
130 + <ProviderAccentColorPicker
131 + displayName="Example provider"
132 + value={undefined}
133 + onCommit={onCommit}
134 + />,
135 + );
136 +
137 + await open("Add accent color for Example provider");
138 + expect(byLabel<HTMLInputElement>("Custom hex accent color").value).toBe("#2563eb");
139 + expect(onCommit).not.toHaveBeenCalled();
140 + await userEvent.keyboard("{Escape}");
141 + expect(onCommit).not.toHaveBeenCalled();
142 + });
143 +
144 + it("adds the displayed default without adjusting a color control", async () => {
145 + const onCommit = vi.fn();
146 + await using screen = await renderPicker(
147 + <ProviderAccentColorPicker
148 + displayName="Example provider"
149 + value={undefined}
150 + onCommit={onCommit}
151 + />,
152 + );
153 +
154 + await open("Add accent color for Example provider");
155 + await userEvent.click(page.getByRole("button", { name: "Add color", exact: true }));
156 +
157 + expect(onCommit).toHaveBeenCalledExactlyOnceWith("#2563eb");
158 + await expect
159 + .element(screen.getByRole("button", { name: "Change accent color for Example provider" }))
160 + .toBeVisible();
161 + await vi.waitFor(() =>
162 + expect(document.querySelector('[aria-label="Custom hex accent color"]')).toBeNull(),
163 + );
164 + });
165 +
166 + it("lets keyboard users add the displayed default", async () => {
167 + const onCommit = vi.fn();
168 + await using screen = await renderPicker(
169 + <ProviderAccentColorPicker
170 + displayName="Example provider"
171 + value={undefined}
172 + onCommit={onCommit}
173 + />,
174 + );
175 +
176 + await open("Add accent color for Example provider");
177 + await act(async () => byLabel("Accent color saturation").focus());
178 + await userEvent.tab();
179 + await userEvent.tab();
180 + await userEvent.tab();
181 + await userEvent.tab();
182 + await userEvent.keyboard("{Enter}");
183 +
184 + expect(onCommit).toHaveBeenCalledExactlyOnceWith("#2563eb");
185 + await expect
186 + .element(screen.getByRole("button", { name: "Change accent color for Example provider" }))
187 + .toBeVisible();
188 + });
189 +
190 + it("keeps live color editing and allows clearing back to unset", async () => {
191 + const onCommit = vi.fn();
192 + await using screen = await renderPicker(
193 + <ProviderAccentColorPicker
194 + displayName="Example provider"
195 + value="#ff0000"
196 + onCommit={onCommit}
197 + />,
198 + );
199 +
200 + await open("Change accent color for Example provider");
201 + await press(HUE, "ArrowRight", true);
202 + expect(onCommit).toHaveBeenLastCalledWith("#ff2a00");
203 + await userEvent.click(page.getByRole("button", { name: "Clear color", exact: true }));
204 + expect(onCommit).toHaveBeenLastCalledWith("");
205 + await expect
206 + .element(screen.getByRole("button", { name: "Add accent color for Example provider" }))
207 + .toBeVisible();
208 + });
209 +
210 it("commits a drag that is still in progress when the popover closes", async () => {
211 await using screen = await renderAccentPicker("#ff0000");
212
@@ -145,6 +228,9 @@ describe("provider accent color picker", () => {
228 await userEvent.fill(byLabel("Custom hex accent color"), "#ff0000");
229
230 expect(screen.onCommit).toHaveBeenLastCalledWith("#ff0000");
231 + await userEvent.fill(byLabel("Custom hex accent color"), "#00FF00");
232 + await screen.echo("#00FF00");
233 + expect(byLabel<HTMLInputElement>("Custom hex accent color").value).toBe("#00FF00");
234 });
235
236 it("shows the saved color again when it is reverted outside the picker", async () => {
@@ -155,6 +241,12 @@ describe("provider accent color picker", () => {
241 await screen.echo("#00ff00");
242 await screen.echo("#ff0000");
243
158 - expect(byLabel("Change accent color for Codex").style.backgroundColor).toBe("rgb(255, 0, 0)");
244 + expect(byLabel<HTMLInputElement>("Custom hex accent color").value).toBe("#ff0000");
245 + await screen.echo("");
246 + expect(byLabel<HTMLInputElement>("Custom hex accent color").value).toBe("#2563eb");
247 + await userEvent.click(page.getByRole("button", { name: "Add color", exact: true }));
248 + expect(screen.onCommit).toHaveBeenLastCalledWith("#2563eb");
249 +
250 + expect(byLabel("Change accent color for Codex").style.backgroundColor).toBe("rgb(37, 99, 235)");
251 });
252 });