{props.enableAlpha ?
: null}
diff --git a/packages/components/color-picker/props.ts b/packages/components/color-picker/props.ts
index f0757763bc..770065bf04 100644
--- a/packages/components/color-picker/props.ts
+++ b/packages/components/color-picker/props.ts
@@ -30,6 +30,10 @@ export default {
default: true,
},
/** 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效 */
+ eyeDropper: {
+ type: [Boolean, Object] as unknown as PropType
,
+ default: false as TdColorPickerProps['eyeDropper'],
+ },
format: {
type: String as PropType,
default: 'RGB' as TdColorPickerProps['format'],
diff --git a/packages/components/color-picker/type.ts b/packages/components/color-picker/type.ts
index dae9992b4b..3898e485b9 100644
--- a/packages/components/color-picker/type.ts
+++ b/packages/components/color-picker/type.ts
@@ -9,6 +9,13 @@ import { PopupProps } from '../popup';
import { SelectInputProps } from '../select-input';
import { SizeEnum } from '../common';
+export type EyeDropperConfig =
+ | boolean
+ | {
+ mode?: 'native' | 'fallback';
+ showPreview?: boolean;
+ };
+
export interface TdColorPickerProps {
/**
* 无边框模式
@@ -39,6 +46,11 @@ export interface TdColorPickerProps {
* @default true
*/
enableMultipleGradient?: boolean;
+ /**
+ * 是否开启吸色(屏幕取色)功能。开启后颜色条前显示吸色按钮
+ * @default false
+ */
+ eyeDropper?: EyeDropperConfig;
/**
* 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效
* @default RGB
@@ -133,6 +145,11 @@ export interface TdColorPickerPanelProps {
* @default true
*/
enableMultipleGradient?: boolean;
+ /**
+ * 是否开启吸色(屏幕取色)功能。开启后颜色条前显示吸色按钮
+ * @default false
+ */
+ eyeDropper?: EyeDropperConfig;
/**
* 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效
* @default RGB
@@ -198,7 +215,8 @@ export type ColorPickerChangeTrigger =
| 'palette-alpha-bar'
| 'input'
| 'preset'
- | 'recent';
+ | 'recent'
+ | 'eyedropper';
export interface ColorObject {
alpha: number;
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 37e856e03f..22360f9bf9 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -335,6 +335,9 @@ importers:
'@tdesign/shared-utils':
specifier: workspace:^
version: link:packages/shared/utils
+ html2canvas-pro:
+ specifier: 2.2.4
+ version: 2.2.4
tdesign-vue-next:
specifier: workspace:^
version: link:packages/tdesign-vue-next
@@ -5066,6 +5069,10 @@ packages:
bare-url@2.4.3:
resolution: {integrity: sha512-Kccpc7ACfXaxfeInfqKcZtW4pT5YBn1mesc4sCsun6sRwtbJ4h+sNOaksUpYEJUKfN65YWC6Bw2OJEFiKxq8nQ==}
+ base64-arraybuffer@1.0.2:
+ resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
+ engines: {node: '>= 0.6.0'}
+
base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
@@ -5547,6 +5554,9 @@ packages:
peerDependencies:
postcss: ^8.0.9
+ css-line-break@2.1.0:
+ resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
+
css-select@4.3.0:
resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==}
@@ -7111,6 +7121,10 @@ packages:
resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==}
engines: {node: '>=12'}
+ html2canvas-pro@2.2.4:
+ resolution: {integrity: sha512-fo/VOiQZ3oWykAPvnMNHymUHzLWJE7c7C7VWPh+ydb+NquFTwqY5rHQRoxkgsaXo/iciVryPNffTvLzYg98xhg==}
+ engines: {node: '>=16.0.0'}
+
htmlparser2@10.1.0:
resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==}
@@ -10149,6 +10163,9 @@ packages:
resolution: {integrity: sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==}
engines: {node: '>=0.10'}
+ text-segmentation@1.0.3:
+ resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}
+
text-table@0.2.0:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
@@ -10658,6 +10675,9 @@ packages:
util@0.12.5:
resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==}
+ utrie@1.0.2:
+ resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
+
uuid@14.0.1:
resolution: {integrity: sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==}
hasBin: true
@@ -16225,6 +16245,8 @@ snapshots:
dependencies:
bare-path: 3.0.0
+ base64-arraybuffer@1.0.2: {}
+
base64-js@1.5.1: {}
baseline-browser-mapping@2.10.30: {}
@@ -16753,6 +16775,10 @@ snapshots:
dependencies:
postcss: 8.5.14
+ css-line-break@2.1.0:
+ dependencies:
+ utrie: 1.0.2
+
css-select@4.3.0:
dependencies:
boolbase: 1.0.0
@@ -18695,6 +18721,11 @@ snapshots:
dependencies:
whatwg-encoding: 2.0.0
+ html2canvas-pro@2.2.4:
+ dependencies:
+ css-line-break: 2.1.0
+ text-segmentation: 1.0.3
+
htmlparser2@10.1.0:
dependencies:
domelementtype: 2.3.0
@@ -22431,6 +22462,10 @@ snapshots:
text-extensions@1.9.0: {}
+ text-segmentation@1.0.3:
+ dependencies:
+ utrie: 1.0.2
+
text-table@0.2.0: {}
through2@2.0.5:
@@ -22972,6 +23007,10 @@ snapshots:
is-typed-array: 1.1.15
which-typed-array: 1.1.19
+ utrie@1.0.2:
+ dependencies:
+ base64-arraybuffer: 1.0.2
+
uuid@14.0.1:
optional: true