Skip to content

Commit 435cda9

Browse files
only21milclaudemaria-rcks
authored
fix(web): keep theme color alpha when a hex value is typed (pingdotgg#23136)
Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: maria-rcks <[email protected]>
1 parent 6a241ea commit 435cda9

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎apps/web/src/components/settings/ThemeColorPicker.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function ThemeColorPickerPanel({
144144
const nextHsv = hexToHsv(nextValue);
145145
setHsv(nextHsv);
146146
setRgbDraft(themeRgbValue(nextValue));
147-
onChange(nextValue.toLowerCase());
147+
onChange(nextValue.toLowerCase() + alphaSuffix);
148148
};
149149

150150
const handleRgbChange = (nextValue: string) => {

‎apps/web/src/components/settings/colorPickers.browser.test.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ describe("theme color field", () => {
106106
await echo("#ffffff");
107107
expect(slider(HUE).getAttribute("aria-valuenow")).toBe("10");
108108
});
109+
110+
it("keeps a translucent color's alpha when a hex value is typed", async () => {
111+
await using screen = await renderThemeField("#22ccff80");
112+
const { onChange } = screen;
113+
114+
await userEvent.fill(byLabel("Accent color picker hex value"), "#ff0000");
115+
expect(onChange).toHaveBeenLastCalledWith("accent", "#ff000080");
116+
});
109117
});
110118

111119
async function renderAccentPicker(value: string) {

0 commit comments

Comments
 (0)