gradio-pr-bot commited on
Commit
d1c22c2
·
verified ·
1 Parent(s): 53753fd

Upload folder using huggingface_hub

Browse files
6.16.0/colorpicker/Example.svelte ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ export let value: string | null;
3
+ export let type: "gallery" | "table";
4
+ export let selected = false;
5
+ </script>
6
+
7
+ <div
8
+ style="background-color: {value ? value : 'black'}"
9
+ class:table={type === "table"}
10
+ class:gallery={type === "gallery"}
11
+ class:selected
12
+ />
13
+
14
+ <style>
15
+ div {
16
+ width: var(--size-10);
17
+ height: var(--size-10);
18
+ }
19
+ .table {
20
+ margin: 0 auto;
21
+ }
22
+ </style>
6.16.0/colorpicker/Index.svelte ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svelte:options accessors={true} />
2
+
3
+ <script context="module" lang="ts">
4
+ export { default as BaseColorPicker } from "./shared/Colorpicker.svelte";
5
+ export { default as BaseExample } from "./Example.svelte";
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { Gradio } from "@gradio/utils";
10
+ import Colorpicker from "./shared/Colorpicker.svelte";
11
+ import { Block } from "@gradio/atoms";
12
+ import { StatusTracker } from "@gradio/statustracker";
13
+ import type { ColorPickerProps, ColorPickerEvents } from "./types";
14
+
15
+ let props = $props();
16
+ const gradio = new Gradio<ColorPickerEvents, ColorPickerProps>(props, {
17
+ value: "#000000"
18
+ });
19
+ let old_value = $state(gradio.props.value);
20
+ let label = $derived(
21
+ gradio.shared.label || gradio.i18n("color_picker.color_picker")
22
+ );
23
+
24
+ $effect(() => {
25
+ if (old_value !== gradio.props.value) {
26
+ old_value = gradio.props.value;
27
+ gradio.dispatch("change", gradio.props.value);
28
+ }
29
+ });
30
+ </script>
31
+
32
+ <Block
33
+ visible={gradio.shared.visible}
34
+ elem_id={gradio.shared.elem_id}
35
+ elem_classes={gradio.shared.elem_classes}
36
+ container={gradio.shared.container}
37
+ scale={gradio.shared.scale}
38
+ min_width={gradio.shared.min_width}
39
+ >
40
+ <StatusTracker
41
+ autoscroll={gradio.shared.autoscroll}
42
+ i18n={gradio.i18n}
43
+ {...gradio.shared.loading_status}
44
+ on_clear_status={() =>
45
+ gradio.dispatch("clear_status", gradio.shared.loading_status)}
46
+ />
47
+
48
+ <Colorpicker
49
+ bind:value={gradio.props.value}
50
+ {label}
51
+ info={gradio.props.info}
52
+ show_label={gradio.shared.show_label}
53
+ disabled={!gradio.shared.interactive}
54
+ on_input={() => gradio.dispatch("input")}
55
+ on_release={() => gradio.dispatch("release", gradio.props.value)}
56
+ on_submit={() => gradio.dispatch("submit")}
57
+ on_blur={() => gradio.dispatch("blur")}
58
+ on_focus={() => gradio.dispatch("focus")}
59
+ />
60
+ </Block>
6.16.0/colorpicker/package.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@gradio/colorpicker",
3
+ "version": "0.5.12",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "main": "./Index.svelte",
11
+ "exports": {
12
+ ".": {
13
+ "gradio": "./Index.svelte",
14
+ "svelte": "./dist/Index.svelte",
15
+ "types": "./dist/Index.svelte.d.ts"
16
+ },
17
+ "./example": {
18
+ "gradio": "./Example.svelte",
19
+ "svelte": "./dist/Example.svelte",
20
+ "types": "./dist/Example.svelte.d.ts"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "dependencies": {
25
+ "@gradio/atoms": "workspace:^",
26
+ "@gradio/statustracker": "workspace:^",
27
+ "@gradio/utils": "workspace:^",
28
+ "@gradio/icons": "workspace:^",
29
+ "tinycolor2": "^1.6.0",
30
+ "@types/tinycolor2": "^1.4.6"
31
+ },
32
+ "devDependencies": {
33
+ "@gradio/preview": "workspace:^"
34
+ },
35
+ "peerDependencies": {
36
+ "svelte": "^5.48.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/gradio-app/gradio.git",
41
+ "directory": "js/colorpicker"
42
+ }
43
+ }
6.16.0/colorpicker/shared/Colorpicker.svelte ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import { onMount, tick } from "svelte";
3
+ import tinycolor from "tinycolor2";
4
+ import { BlockTitle } from "@gradio/atoms";
5
+ import { click_outside } from "./events";
6
+ import { Eyedropper } from "@gradio/icons";
7
+ import { hsva_to_rgba, format_color, normalize_color } from "./utils";
8
+
9
+ let {
10
+ value = $bindable(),
11
+ label,
12
+ info,
13
+ disabled,
14
+ show_label,
15
+ on_input = () => {},
16
+ on_release = () => {},
17
+ on_submit = () => {},
18
+ on_blur = () => {},
19
+ on_focus = () => {}
20
+ }: {
21
+ value: string;
22
+ label: string;
23
+ info?: string;
24
+ disabled: boolean;
25
+ show_label: boolean;
26
+ on_input?: () => void;
27
+ on_release?: () => void;
28
+ on_submit?: () => void;
29
+ on_blur?: () => void;
30
+ on_focus?: () => void;
31
+ } = $props();
32
+
33
+ let dialog_open = $state(false);
34
+ let current_mode: "hex" | "rgb" | "hsl" = $state("hex");
35
+
36
+ let eyedropper_supported = false;
37
+
38
+ let sl_wrap: HTMLDivElement;
39
+ let hue_wrap: HTMLDivElement;
40
+
41
+ let sl_marker_pos = [0, 0];
42
+ let sl_rect: DOMRect | null = null;
43
+ let sl_moving = false;
44
+ let sl = [0, 0];
45
+
46
+ let hue = 0;
47
+ let hue_marker_pos = 0;
48
+ let hue_rect: DOMRect | null = null;
49
+ let hue_moving = false;
50
+
51
+ function handle_hue_down(
52
+ event: MouseEvent & { currentTarget: HTMLDivElement }
53
+ ): void {
54
+ hue_rect = event.currentTarget.getBoundingClientRect();
55
+ hue_moving = true;
56
+ update_hue_from_mouse(event.clientX);
57
+ }
58
+
59
+ function update_hue_from_mouse(x: number): void {
60
+ if (!hue_rect) return;
61
+ const _x = Math.max(0, Math.min(x - hue_rect.left, hue_rect.width)); // Get the x-coordinate relative to the box
62
+ hue_marker_pos = _x;
63
+ const _hue = (_x / hue_rect.width) * 360; // Scale the x position to a hue value (0-360)
64
+
65
+ hue = _hue;
66
+
67
+ value = hsva_to_rgba({ h: _hue, s: sl[0], v: sl[1], a: 1 });
68
+ on_input();
69
+ }
70
+
71
+ function update_color_from_mouse(x: number, y: number): void {
72
+ if (!sl_rect) return;
73
+ const _x = Math.max(0, Math.min(x - sl_rect.left, sl_rect.width));
74
+ const _y = Math.max(0, Math.min(y - sl_rect.top, sl_rect.height));
75
+ sl_marker_pos = [_x, _y];
76
+ const _hsva = {
77
+ h: hue * 1,
78
+ s: _x / sl_rect.width,
79
+ v: 1 - _y / sl_rect.height,
80
+ a: 1
81
+ };
82
+
83
+ sl = [_hsva.s, _hsva.v];
84
+
85
+ value = hsva_to_rgba(_hsva);
86
+ on_input();
87
+ }
88
+
89
+ function handle_sl_down(
90
+ event: MouseEvent & { currentTarget: HTMLDivElement }
91
+ ): void {
92
+ sl_moving = true;
93
+ sl_rect = event.currentTarget.getBoundingClientRect();
94
+ update_color_from_mouse(event.clientX, event.clientY);
95
+ }
96
+
97
+ function handle_move(event: MouseEvent): void {
98
+ if (sl_moving) update_color_from_mouse(event.clientX, event.clientY);
99
+ if (hue_moving) update_hue_from_mouse(event.clientX);
100
+ }
101
+
102
+ function handle_end(): void {
103
+ const should_dispatch_release = sl_moving || hue_moving;
104
+ sl_moving = false;
105
+ hue_moving = false;
106
+ if (should_dispatch_release) {
107
+ on_release();
108
+ }
109
+ }
110
+
111
+ async function update_mouse_from_color(color: string): Promise<void> {
112
+ if (sl_moving || hue_moving) return;
113
+ await tick();
114
+ if (!color) return;
115
+
116
+ if (!sl_rect && sl_wrap) {
117
+ sl_rect = sl_wrap.getBoundingClientRect();
118
+ }
119
+
120
+ if (!hue_rect && hue_wrap) {
121
+ hue_rect = hue_wrap.getBoundingClientRect();
122
+ }
123
+
124
+ // Exit if we still don't have valid rectangles
125
+ if (!sl_rect || !hue_rect) return;
126
+
127
+ const hsva = tinycolor(color).toHsv();
128
+ const _x = hsva.s * sl_rect.width;
129
+ const _y = (1 - hsva.v) * sl_rect.height;
130
+ sl_marker_pos = [_x, _y];
131
+ sl = [hsva.s, hsva.v];
132
+ hue = hsva.h;
133
+ hue_marker_pos = (hsva.h / 360) * hue_rect.width;
134
+ }
135
+
136
+ function request_eyedropper(): void {
137
+ // @ts-ignore
138
+ const eyeDropper = new EyeDropper();
139
+
140
+ eyeDropper.open().then((result: { sRGBHex: string }) => {
141
+ value = result.sRGBHex;
142
+ });
143
+ on_input();
144
+ }
145
+
146
+ const modes = [
147
+ ["Hex", "hex"],
148
+ ["RGB", "rgb"],
149
+ ["HSL", "hsl"]
150
+ ] as const;
151
+
152
+ let color_string = $derived.by(() => format_color(value, current_mode));
153
+
154
+ onMount(async () => {
155
+ // @ts-ignore
156
+ eyedropper_supported = window !== undefined && !!window.EyeDropper;
157
+ });
158
+
159
+ function handle_click_outside(): void {
160
+ dialog_open = false;
161
+ }
162
+
163
+ $effect(() => {
164
+ update_mouse_from_color(value);
165
+ });
166
+ </script>
167
+
168
+ <BlockTitle {show_label} {info}>{label}</BlockTitle>
169
+ <button
170
+ class="dialog-button"
171
+ aria-label={label}
172
+ style:background={value}
173
+ {disabled}
174
+ onfocus={on_focus}
175
+ onblur={on_blur}
176
+ onclick={() => {
177
+ update_mouse_from_color(value);
178
+ dialog_open = !dialog_open;
179
+ }}
180
+ />
181
+
182
+ <svelte:window onmousemove={handle_move} onmouseup={handle_end} />
183
+
184
+ {#if dialog_open}
185
+ <div class="color-picker" use:click_outside={handle_click_outside}>
186
+ <div
187
+ class="color-gradient"
188
+ role="slider"
189
+ aria-label="Saturation and brightness"
190
+ aria-valuetext={value}
191
+ tabindex="0"
192
+ onmousedown={handle_sl_down}
193
+ style="--hue:{hue}"
194
+ bind:this={sl_wrap}
195
+ >
196
+ <div
197
+ class="marker"
198
+ style:transform="translate({sl_marker_pos[0]}px,{sl_marker_pos[1]}px)"
199
+ style:background={value}
200
+ />
201
+ </div>
202
+ <div
203
+ class="hue-slider"
204
+ role="slider"
205
+ aria-label="Hue"
206
+ aria-valuemin={0}
207
+ aria-valuemax={360}
208
+ aria-valuenow={Math.round(hue)}
209
+ tabindex="0"
210
+ onmousedown={handle_hue_down}
211
+ bind:this={hue_wrap}
212
+ >
213
+ <div
214
+ class="marker"
215
+ style:background={"hsl(" + hue + ", 100%, 50%)"}
216
+ style:transform="translateX({hue_marker_pos}px)"
217
+ />
218
+ </div>
219
+
220
+ <div class="input">
221
+ <button class="swatch" style:background={value}></button>
222
+ <div>
223
+ <div class="input-wrap">
224
+ <input
225
+ type="text"
226
+ bind:value={color_string}
227
+ onchange={(e) => {
228
+ value = normalize_color(e.currentTarget.value);
229
+ }}
230
+ onkeydown={(e) => {
231
+ if (e.key === "Enter") {
232
+ on_submit();
233
+ }
234
+ }}
235
+ />
236
+ <button class="eyedropper" onclick={request_eyedropper}>
237
+ {#if eyedropper_supported}
238
+ <Eyedropper />
239
+ {/if}
240
+ </button>
241
+ </div>
242
+
243
+ <div class="buttons">
244
+ {#each modes as [label, value]}
245
+ <button
246
+ class="button"
247
+ class:active={current_mode === value}
248
+ onclick={() => {
249
+ current_mode = value;
250
+ }}>{label}</button
251
+ >
252
+ {/each}
253
+ </div>
254
+ </div>
255
+ </div>
256
+ </div>
257
+ {/if}
258
+
259
+ <style>
260
+ .dialog-button {
261
+ display: block;
262
+ width: var(--size-10);
263
+ height: var(--size-5);
264
+ border: var(--block-border-width) solid var(--block-border-color);
265
+ }
266
+
267
+ .dialog-button:disabled {
268
+ cursor: not-allowed;
269
+ }
270
+
271
+ .input {
272
+ display: flex;
273
+ align-items: center;
274
+ padding: 0 10px 15px;
275
+ }
276
+
277
+ .input input {
278
+ height: 30px;
279
+ width: 100%;
280
+ flex-shrink: 1;
281
+ border-bottom-left-radius: 0;
282
+ border: 1px solid var(--block-border-color);
283
+ letter-spacing: -0.05rem;
284
+ border-left: none;
285
+ border-right: none;
286
+ font-family: var(--font-mono);
287
+ font-size: var(--scale-000);
288
+ padding-left: 15px;
289
+ padding-right: 0;
290
+ background-color: var(--background-fill-secondary);
291
+ color: var(--block-label-text-color);
292
+ }
293
+
294
+ .swatch {
295
+ width: 50px;
296
+ height: 50px;
297
+ border-top-left-radius: 15px;
298
+ border-bottom-left-radius: 15px;
299
+ flex-shrink: 0;
300
+ border: 1px solid var(--block-border-color);
301
+ }
302
+
303
+ .color-picker {
304
+ width: 230px;
305
+ background: var(--background-fill-secondary);
306
+ border: 1px solid var(--block-border-color);
307
+ border-radius: var(--block-radius);
308
+ margin: var(--spacing-sm) 0;
309
+ }
310
+
311
+ .buttons {
312
+ height: 20px;
313
+ display: flex;
314
+ justify-content: stretch;
315
+ gap: 0px;
316
+ }
317
+
318
+ .buttons button {
319
+ display: flex;
320
+ align-items: center;
321
+ justify-content: center;
322
+ border: 1px solid var(--block-border-color);
323
+ background: var(--background-fill-secondary);
324
+ padding: 3px 6px;
325
+ font-size: var(--scale-000);
326
+ cursor: pointer;
327
+ border-right: none;
328
+ width: 100%;
329
+ border-top: none;
330
+ }
331
+
332
+ .buttons button:first-child {
333
+ border-left: none;
334
+ }
335
+
336
+ .buttons button:last-child {
337
+ border-bottom-right-radius: 15px;
338
+ border-right: 1px solid var(--block-border-color);
339
+ }
340
+
341
+ .buttons button:hover {
342
+ background: var(--background-fill-secondary-hover);
343
+ font-weight: var(--weight-bold);
344
+ }
345
+
346
+ .buttons button.active {
347
+ background: var(--background-fill-secondary);
348
+ font-weight: var(--weight-bold);
349
+ }
350
+
351
+ .input-wrap {
352
+ display: flex;
353
+ }
354
+
355
+ .color-gradient {
356
+ position: relative;
357
+ --hue: white;
358
+ background:
359
+ linear-gradient(rgba(0, 0, 0, 0), #000),
360
+ linear-gradient(90deg, #fff, hsl(var(--hue), 100%, 50%));
361
+ width: 100%;
362
+ height: 150px;
363
+ border-radius: var(--radius-sm) var(--radius-sm) 0 0;
364
+ }
365
+
366
+ .hue-slider {
367
+ position: relative;
368
+ width: 90%;
369
+ margin: 10px auto;
370
+ height: 10px;
371
+ border-radius: 5px;
372
+ background: linear-gradient(
373
+ to right,
374
+ hsl(0, 100%, 50%) 0%,
375
+ #ff0 17%,
376
+ lime 33%,
377
+ cyan 50%,
378
+ blue 67%,
379
+ magenta 83%,
380
+ red 100%
381
+ );
382
+ }
383
+
384
+ .swatch {
385
+ width: 50px;
386
+ height: 50px;
387
+ border-top-left-radius: 15px;
388
+ border-bottom-left-radius: 15px;
389
+ flex-shrink: 0;
390
+ border: 1px solid var(--block-border-color);
391
+ }
392
+
393
+ .eyedropper {
394
+ display: flex;
395
+ align-items: center;
396
+ justify-content: center;
397
+ width: 25px;
398
+ height: 30px;
399
+ border-top-right-radius: 15px;
400
+ border: 1px solid var(--block-border-color);
401
+ border-left: none;
402
+ background: var(--background-fill-secondary);
403
+ height: 30px;
404
+ padding: 7px 7px 5px 0px;
405
+ cursor: pointer;
406
+ }
407
+
408
+ .marker {
409
+ position: absolute;
410
+ width: 14px;
411
+ height: 14px;
412
+ border-radius: 50%;
413
+ border: 2px solid white;
414
+ top: -2px;
415
+ left: -7px;
416
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
417
+ pointer-events: none;
418
+ }
419
+
420
+ input {
421
+ width: 100%;
422
+ height: 30px;
423
+ border: 1px solid var(--block-border-color);
424
+ border-radius: var(--radius-sm);
425
+ padding: 0 var(--size-2);
426
+ font-family: var(--font-mono);
427
+ font-size: var(--scale-000);
428
+ color: var(--block-label-text-color);
429
+ background-color: var(--background-fill-primary);
430
+ }
431
+ </style>
6.16.0/colorpicker/shared/events.ts ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Svelte action to handle clicks outside of a DOM node
3
+ * @param node DOM node to check the click is outside of
4
+ * @param callback callback function to call if click is outside
5
+ * @returns svelte action return object with destroy method to remove event listener
6
+ */
7
+ export function click_outside(
8
+ node: Node,
9
+ callback: (arg: MouseEvent) => void
10
+ ): any {
11
+ const handle_click = (event: MouseEvent): void => {
12
+ if (
13
+ node &&
14
+ !node.contains(event.target as Node) &&
15
+ !event.defaultPrevented
16
+ ) {
17
+ callback(event);
18
+ }
19
+ };
20
+
21
+ document.addEventListener("mousedown", handle_click, true);
22
+
23
+ return {
24
+ destroy() {
25
+ document.removeEventListener("mousedown", handle_click, true);
26
+ }
27
+ };
28
+ }
6.16.0/colorpicker/shared/utils.ts ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import tinycolor from "tinycolor2";
2
+
3
+ export function hsva_to_rgba(hsva: {
4
+ h: number;
5
+ s: number;
6
+ v: number;
7
+ a: number;
8
+ }): string {
9
+ const saturation = hsva.s;
10
+ const value = hsva.v;
11
+ let chroma = saturation * value;
12
+ const hue_by_60 = hsva.h / 60;
13
+ let x = chroma * (1 - Math.abs((hue_by_60 % 2) - 1));
14
+ const m = value - chroma;
15
+
16
+ chroma = chroma + m;
17
+ x = x + m;
18
+
19
+ const index = Math.floor(hue_by_60) % 6;
20
+ const red = [chroma, x, m, m, x, chroma][index];
21
+ const green = [x, chroma, chroma, x, m, m][index];
22
+ const blue = [m, m, x, chroma, chroma, x][index];
23
+
24
+ return tinycolor({
25
+ r: red * 255,
26
+ g: green * 255,
27
+ b: blue * 255,
28
+ a: hsva.a
29
+ }).toHexString();
30
+ }
31
+
32
+ export function normalize_color(color: string): string {
33
+ const tc = tinycolor(color);
34
+ if (tc.isValid()) {
35
+ return tc.toHexString();
36
+ }
37
+ return color;
38
+ }
39
+
40
+ export function format_color(
41
+ color: string,
42
+ mode: "hex" | "rgb" | "hsl"
43
+ ): string {
44
+ if (mode === "hex") {
45
+ return tinycolor(color).toHexString();
46
+ } else if (mode === "rgb") {
47
+ return tinycolor(color).toRgbString();
48
+ }
49
+ return tinycolor(color).toHslString();
50
+ }
6.16.0/colorpicker/types.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export interface ColorPickerProps {
2
+ value: string;
3
+ info: string;
4
+ }
5
+
6
+ export interface ColorPickerEvents {
7
+ change: string;
8
+ input: never;
9
+ release: string;
10
+ submit: never;
11
+ focus: never;
12
+ blur: never;
13
+ clear_status: any;
14
+ }