Skip to content

Commit 71377a6

Browse files
authored
feat(VColorPicker): customizable eyeDropper icon (#21656)
resolves #21406
1 parent f5f5b4d commit 71377a6

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

packages/api-generator/src/locale/en/VColorPicker.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"props": {
33
"canvasHeight": "Height of canvas.",
44
"dotSize": "Changes the size of the selection dot on the canvas.",
5+
"eyeDropperIcon": "Icon used to trigger EyeDropper API.",
56
"flat": "Removes elevation.",
67
"hideCanvas": "Hides canvas.",
78
"hideSliders": "Hides sliders.",

packages/docs/src/data/new-in.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"baseColor": "3.8.0"
4444
}
4545
},
46+
"VColorPicker": {
47+
"props": {
48+
"eyeDropperIcon": "3.10.0"
49+
}
50+
},
4651
"VCombobox": {
4752
"props": {
4853
"clearOnSelect": "3.5.0",

packages/vuetify/src/components/VColorPicker/VColorPicker.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import './VColorPicker.sass'
44
// Components
55
import { VColorPickerCanvas } from './VColorPickerCanvas'
66
import { VColorPickerEdit } from './VColorPickerEdit'
7-
import { VColorPickerPreview } from './VColorPickerPreview'
7+
import { makeVColorPickerPreviewProps, VColorPickerPreview } from './VColorPickerPreview'
88
import { VColorPickerSwatches } from './VColorPickerSwatches'
99
import { makeVPickerProps, VPicker } from '@/labs/VPicker/VPicker'
1010

@@ -16,7 +16,7 @@ import { useProxiedModel } from '@/composables/proxiedModel'
1616
// Utilities
1717
import { computed, onBeforeMount, ref, watch } from 'vue'
1818
import { extractColor, modes, nullColor } from './util'
19-
import { consoleWarn, defineComponent, HSVtoCSS, parseColor, propsFactory, RGBtoHSV, useRender } from '@/util'
19+
import { consoleWarn, defineComponent, HSVtoCSS, parseColor, pick, propsFactory, RGBtoHSV, useRender } from '@/util'
2020

2121
// Types
2222
import type { DeepReadonly, PropType } from 'vue'
@@ -56,6 +56,7 @@ export const makeVColorPickerProps = propsFactory({
5656
},
5757

5858
...makeVPickerProps({ hideHeader: true }),
59+
...pick(makeVColorPickerPreviewProps(), ['eyeDropperIcon']),
5960
}, 'VColorPicker')
6061

6162
export const VColorPicker = defineComponent({
@@ -172,6 +173,7 @@ export const VColorPicker = defineComponent({
172173
onUpdate:color={ updateColor }
173174
hideAlpha={ !mode.value.endsWith('a') }
174175
disabled={ props.disabled }
176+
eyeDropperIcon={ props.eyeDropperIcon }
175177
/>
176178
)}
177179

packages/vuetify/src/components/VColorPicker/VColorPickerPreview.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { VSlider } from '@/components/VSlider'
77

88
// Composables
99
import { makeComponentProps } from '@/composables/component'
10+
import { IconValue } from '@/composables/icons'
1011
import { useLocale } from '@/composables/locale'
1112

1213
// Utilities
@@ -32,6 +33,10 @@ export const makeVColorPickerPreviewProps = propsFactory({
3233
},
3334
disabled: Boolean,
3435
hideAlpha: Boolean,
36+
eyeDropperIcon: {
37+
type: IconValue,
38+
default: '$eyeDropper',
39+
},
3540

3641
...makeComponentProps(),
3742
}, 'VColorPickerPreview')
@@ -80,7 +85,7 @@ export const VColorPickerPreview = defineComponent({
8085
aria-label={ t('$vuetify.colorPicker.ariaLabel.eyedropper') }
8186
density="comfortable"
8287
disabled={ props.disabled }
83-
icon="$eyeDropper"
88+
icon={ props.eyeDropperIcon }
8489
variant="plain"
8590
onClick={ openEyeDropper }
8691
/>

0 commit comments

Comments
 (0)