npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ccs-colorpicker

v1.1.2

Published

A multi format Colorpicker built with Svelte. The Colorpicker accepts and sets hex(a), rgb(a) and hsl(a) colors.

Downloads

4

Readme

Colorpicker 🎨

A multi format Colorpicker built with Svelte. The Colorpicker accepts and sets hex(a), rgb(a) and hsl(a) colors.

Image

Features

  • Choose your color by clicking or dragging on a palette.
  • Set the hue and opacity of your chosen color using Slider controls.
  • Convert your selected color to your preferred color format (hexa, rgba, hsla).
  • Set your color by typing into an input.
  • A swatch panel for keeping track of recent colours or for passing favourite colors so they can be easily set again.
  • Handy keyboard events to tab through control panel, set colors and close the Colorpicker.
  • Colorpicker anchors to its preview element which displays the selected color and acts as a button to display the Colorpicker.
  • Viewport positional awareness - the colorpicker centers by default but will adapt and position itself appropriately based on available space.
  • Colorpicker renders outside the dom structure which prevents problems with overflow clipping in scrolling containers.

Installation

  1. Navigate to your project in the terminal.
  2. Run yarn add ccs-colorpicker.
  3. Or use npm npm i ccs-colorpicker.

Usage

import Colorpicker from "ccs-colorpicker"

<Colorpicker
  //must be a valid color supported by Colorpicker (hsl(a), hex(a) or rgb(a))
  value="#abc" 
  //An array of 12 or less swatches for use in the Colorpicker panel.
  swatches=["#abc2", "rgba(255,2,100,0.5)", "hsl(360,50,50)"] 
  //disable swatches for the Colorpicker. Defaults to false
  disableSwatches={true | false} 
  //Open or close the Colorpicker. Defaults to false
  open={true | false} 
  //width of the Colorpreview. Defaults to 25px
  width="25px" 
  //height of the Colorpreview. Defaults to 25px
  height="25px"
  //change event - invoked when color has been selected
  on:change={selectedColor => {}}
  //remove swatch - invoked when swatch has been removed
  on:removeswatch={removedSwatch => {})}
  //add swatch event - invoked when a swatch has been added
  on:addswatch={addedSwatch => {}}
  />

Events

The Colorpicker exposes the following events. In each case, the color will be provided as the first parameter to the bound function.

Change Event on:change={selectedColor: string => {}} The on change event will be invoked whenever a color has been set in the Colorpicker via the palette, the hue slider, the alpha slider or by typing into the input.

Add Swatch on:addswatch={addedSwatch: string => {}} The add swatch event will be invoked when a user adds a swatch by clicking the add button.

Remove Swatch on:removeswatch={removedSwatch: string => {}} The remove swatch will be invoked when a user clicks the delete button that appears when hovering over a swatch.

Swatches

  • By default, added swatches are saved to local storage so that they can be displayed across all Colorpickers in your application.
  • Only 12 or less swatches can be displayed in the Coloricker at any any one time.
  • If more than 12 have been passed the Colorpicker will display the first 12 and warn in the console.
  • An array of swatches can be passed to the Colorpicker to set up a dedicated panel of swatches. This will use provided swatches instead of locally stored swatches. Swatches added will still be saved to local storage.
  • You can disable swatch functionality by passing the disableSwatches={true} property to the Colorpicker.