diff --git a/README.md b/README.md index 025f575..e9b73f7 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,17 @@ Svelte Color Picker currently has one type of colorpicker. #### \ | Props | Value Type | Use | -| ------ | ------ | ------ | -| on:colorChange | function | Given function gets called every time color changes | -| startColor | string | Initializes color picker with the value (hexadecimal without alpha). | +| ----- | ---------- | --- | +| on:colorChange | function | Called whenever the color changes (event.detail contains { r, g, b, a }). | +| startColor | string | Initializes color picker with the value (hexadecimal without alpha), e.g. "#FF0000". | +| background | string | Background color of the picker container (CSS color). Default: "#f2f2f2". | +| opacity | number | Initial alpha value between 0 and 1. Default: 1. | +| alphaSelector | boolean | Show or hide the alpha (opacity) slider. Default: true. | +| colorInfoBox | boolean | Show or hide the color info box (hex and RGB). Default: true. | +| hexCodeInfo | boolean | Show or hide the hex code inside the info box. Default: true. | +| rgbInfo | boolean | Show or hide the RGB values inside the info box. Default: true. | +| width | number (px) | Overall picker width in pixels. Default: 240. | +| height | number (px) | Overall picker height in pixels. Default: 265. | License ---- diff --git a/demo_page/src/App.svelte b/demo_page/src/App.svelte index f8cbca0..81ae67c 100644 --- a/demo_page/src/App.svelte +++ b/demo_page/src/App.svelte @@ -1,60 +1,74 @@ + + - + - +
+
+

Svelte Color Picker

+

A color picker component for svelte.

+ Star +
+
+ +
+
- -
-
-

Svelte Color Picker

-

A color picker component for svelte.

- Star -
-
- -
-
diff --git a/src/HsvPicker.svelte b/src/HsvPicker.svelte index 9e5e1dc..27306fe 100644 --- a/src/HsvPicker.svelte +++ b/src/HsvPicker.svelte @@ -1,340 +1,351 @@ - - -
- +
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
+ {#if alphaSelector} +
-
- -
-
-
+ {/if} + + {#if colorInfoBox} +
+ {#if hexCodeInfo} +
+
+
+ +
+

{hexValue}

+
+ {/if} + + {#if rgbInfo} +
+
+

{r}

+

R

+
-
-

{hexValue}

+
+

{g}

+

G

+
+ +
+

{b}

+

B

+
+
+ {/if}
+ {/if} +
-
-
-

{r}

-

R

-
+