svelte-material-color-picker

0.0.3 • Public • Published


 Svelte Color Picker

Simple color picker made with Svelte

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

Svelte Kanban

## Installation
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:

name default description
margin 1 Distance between color circles.
size 50 Size of the colors circles.
colorsPerRow 6 Number of color circles per row.
defaultTint 500 Default tint displayed for each colors.
selectedColor #f44336 The color selected, hex code with hashtag.
mode palette The 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.
palette link palette The palette used by the picker.

Events

Picker.svelte dispatches the following event:

name detail description
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

/svelte-material-color-picker/

    Package Sidebar

    Install

    npm i svelte-material-color-picker

    Weekly Downloads

    0

    Version

    0.0.3

    License

    none

    Unpacked Size

    29.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • v-py