0.1.0 • Published 5 years ago

svelte-picker v0.1.0

Weekly downloads
46
License
-
Repository
github
Last release
5 years ago

enhanced fork of svelte-color-picker

Svelte Picker [Demo Page]

svelte-v3

Installation

With npm

$ npm i svelte-picker

Usage

In your component :

<script>
import Picker from 'svelte-picker';
// To bind (not necessary)
let picker;

function handleChange(event){
	const {r, g, b, a, hex}  = event.detail;
	// Note that when you call setColor this will be called too
	// (should we change that?)
}

// You can change the color programatically too
onSomeEvent(() => {
	picker.setColor("#000"); // or
	picker.setColor("#000000"); // or
	picker.setColor({r:0, g:255, b:123});
})
</script>

<Picker
	bind:this={picker}
	alpha={true}
	on:colorchange={handleChange}
	startColor={"#FBFBFB"}
/>
PropsValue TypeUse
classstring=""class(es) to be added to the root element
alphaboolean=truewheather to show or not alpha picker
startColorstringInitial color (hexadecimal without alpha)
setColorfunctionset the color of the picker from outside (whitout alpha for now)
on:colorchangecallbackGiven callback gets called every time color changes

License

MIT

Contribute

git clone https://github.com/ramiroaisen/svelte-picker.git
npm i -D
npm run dev

opens a dev server

0.1.0

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago