From 9e7b1ce5a96a2d3fd7665afc43976fbd09434927 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Tue, 24 Nov 2026 17:01:00 +0100 Subject: [PATCH] feat(site): Add custom color picker (#5290) * feat(docs): add custom color picker built on vue-color Replace the native color input in the icon customizers with a dropdown built on vue-color's ChromePicker: a saturation area, hue and alpha sliders, and an eyedropper button where the browser supports it. - Knobs use the same 20px size, shadow and hover/active rings as the customizer's range slider thumbs - The panel is teleported to the body and positioned with floating-ui, so the sidebar's scroll container doesn't clip it - vue-color is loaded lazily when the picker is about to open - Keyboard: Tab moves through the panel and on to the hex field, Shift+Tab goes back, Escape closes and returns focus to the swatch. vue-color's sliders prevent the default of every key, so Tab is handled by hand - Colors are emitted as hex, with 8 digits when alpha is below 100% Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G9u8FhybXR7xuDECHDUz2n * feat(docs): remove opacity slider from color picker The picker now only produces opaque colors, always emitted as 6-digit hex. The hue slider sits alone next to the eyedropper button, and the popover no longer reserves height for the second slider. Also binds aria-expanded as a boolean again, which fixes the vue-tsc error from the previous commit. Vue renders false as "false". Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01G9u8FhybXR7xuDECHDUz2n --------- Co-authored-by: Claude --- .../theme/components/base/ColorPicker.vue | 208 ++++++++++++-- .../components/base/ColorPickerPanel.vue | 269 ++++++++++++++++++ docs/package.json | 1 + pnpm-lock.yaml | 19 ++ 4 files changed, 472 insertions(+), 25 deletions(-) create mode 100644 docs/.vitepress/theme/components/base/ColorPickerPanel.vue diff --git a/docs/.vitepress/theme/components/base/ColorPicker.vue b/docs/.vitepress/theme/components/base/ColorPicker.vue index b5df35e34..4fe6fd9f0 100644 --- a/docs/.vitepress/theme/components/base/ColorPicker.vue +++ b/docs/.vitepress/theme/components/base/ColorPicker.vue @@ -1,5 +1,7 @@ diff --git a/docs/.vitepress/theme/components/base/ColorPickerPanel.vue b/docs/.vitepress/theme/components/base/ColorPickerPanel.vue new file mode 100644 index 000000000..5b42f390c --- /dev/null +++ b/docs/.vitepress/theme/components/base/ColorPickerPanel.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/docs/package.json b/docs/package.json index 5125c4089..42993dfd4 100644 --- a/docs/package.json +++ b/docs/package.json @@ -81,6 +81,7 @@ "resend": "^6.34.1", "sandpack-vue3": "3.1.12", "vue": "^3.5.45", + "vue-color": "^3.3.3", "vue-sonner": "^2.0.9" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bc0b15286..5a7c777b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -221,6 +221,9 @@ importers: vue: specifier: ^3.5.45 version: 3.5.45(typescript@6.0.3) + vue-color: + specifier: ^3.3.3 + version: 3.3.3(vue@3.5.45(typescript@6.0.3)) vue-sonner: specifier: ^2.0.9 version: 2.0.9(@nuxt/kit@4.6.4(@nuxt/schema@4.6.4)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.5)(mlly@1.8.2)(oxc-parser@0.150.0)(rolldown@1.2.16)(unplugin@3.7.0(esbuild@0.28.2)(rolldown@1.2.16)(rollup@4.65.1)(vite@8.3.5(@types/node@26.4.1)(esbuild@0.28.2)(jiti@2.7.0)(less@4.9.1(supports-color@10.2.2))(sass-embedded@1.107.0)(sass@1.107.0)(stylus@0.56.0(supports-color@10.2.2))(terser@5.51.2)(yaml@2.9.1))))(@nuxt/schema@4.6.4)(nuxt@4.6.4(f742eb5eed265f9f1f421f18434259ac)) @@ -10438,6 +10441,9 @@ packages: engines: {node: '>= 18'} hasBin: true + material-colors@1.2.6: + resolution: {integrity: sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg==} + math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} @@ -13803,6 +13809,11 @@ packages: vue-bundle-renderer@2.4.0: resolution: {integrity: sha512-IxHopQZgzTGBiuGERrQrAS7Lr3dCv+qxvgirEgCUFGAD4gYNfiaGYzC1DDojeZmJAmehp9gG8+17PGuVP6Ab2Q==} + vue-color@3.3.3: + resolution: {integrity: sha512-FW/9JXFbCHfFEGv6SFUuK/SE+K61pHoL7lxJMQXcU+Zt7s36Ui1/tMDc3vzGXPrxxRBB+NSzFt+71nEaUJ29dQ==} + peerDependencies: + vue: '>=2.7.0 <4.0.0' + vue-component-type-helpers@3.3.14: resolution: {integrity: sha512-Pq3+OnbCiPCHk0R7KSZrx+j/XXaUn2kSQ1epxq60w8CPbByLjC1EJgV51n4WY851sTXUVzsNMuitywdkdVyKjA==} @@ -24184,6 +24195,8 @@ snapshots: marked@15.0.12: {} + material-colors@1.2.6: {} + math-intrinsics@1.1.0: {} mdast-util-from-markdown@2.0.3(supports-color@10.2.2): @@ -29003,6 +29016,12 @@ snapshots: dependencies: ufo: 1.6.4 + vue-color@3.3.3(vue@3.5.45(typescript@6.0.3)): + dependencies: + material-colors: 1.2.6 + tinycolor2: 1.6.0 + vue: 3.5.45(typescript@6.0.3) + vue-component-type-helpers@3.3.14: {} vue-devtools-stub@0.1.0: {}