0.0.3 • Published 2 years ago

svelte-material-color-picker v0.0.3

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Live demo.

Simple color picker made with Svelte

directly inspired from https://github.com/BennyAlex/material-design-inspired-color-picker

npm i svelte-material-color-picker

Usage

<script>
    import Picker from 'svelte-material-color-picker';
</script>


<Picker on:colorChanged {margin} {size} {colorsPerRow} {defaultTint} />

Props

Full list of props/bindable variables for this component:

namedefaultdescription
margin1Distance between color circles.
size50Size of the colors circles.
colorsPerRow6Number of color circles per row.
defaultTint500Default tint displayed for each colors.
selectedColor#f44336The color selected, hex code with hashtag.
modepaletteThe mode of the color picker. button mode will hide after the palette after selecting a color only showing the color circle of the selected color. palette mode with show the palette and highlight the selected color in it.
palettelink paletteThe palette used by the picker.

Events

Picker.svelte dispatches the following event:

namedetaildescription
colorChanged{ old:string, new:string }Triggers when clicking on a color picker.
<Kanban
  on:colorChanged={(e) => alert(`Color changed from ${e.detail.old} to ${e.detail.new}`)}
/>

Dev Mode

git clone https://github.com/V-Py/svelte-material-color-picker
cd svelte-material-color-picker
npm install
npm run dev