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

simple-color-picker-jq

v0.0.11

Published

Simple Color picker in common.js. (Jquery mod)

Downloads

480

Readme

unstable

simple-color-picker (JQuery mod)

Simple Color picker in common.js.

demo

Installation

NPM

Quickstart

var ColorPicker = require('simple-color-picker-jq');

var colorPicker = new ColorPicker();

And include simple-color-picker.css in your html or import it in your css.

You can retrieve the current color in different formats by using these convenient methods:

  • colorPicker.getColor(); // output depends on previously inputed color format
  • colorPicker.getHexString(); // #FFFFFF
  • colorPicker.getHexNumber(); // 0xFFFFFF
  • colorPicker.getRGB(); // {r: 255, g: 255, b: 255}
  • colorPicker.getHSV(); // {h: 0, s: 0, v: 1}

Options

Options you can pass to constructor in an object like so :

var colorPicker = new ColorPicker({
  color: '#FF0000',
  background: '#454545',
  el: $('body'),
  width: 200,
  height: 200
});

None of these options are mendatory.

color

The default color that the colorpicker will display. Default is #FFFFFF. It can be a hexadecimal number or an hex String.

background

The background color of the colorpicker. Default is transparent. It can be a hexadecimal number or an hex String.

el

A jQuery element to add the colorpicker to. You can also use colorPicker.appendTo(jQuery element) afterwards if you prefer.

width

Desired width of the color picker. Default is 175.

height

Desired height of the color picker. Default is 150.

Methods

.appendTo(jQuery element)

Add the colorPicker instance to a jQuery element.

.remove()

Removes colorpicker from is parent and kill all listeners. Call this method for proper destroy.

.setColor(color)

Manually set the current color of the colorpicker. This is the method used on instantiation to convert color option to actual color for the colorpicker. Param can be a hexadecimal number or an hex String.

.setSize(width, height)

Set size of the color picker for a given width and height. Note that a padding of 5px will be added if you chose to use the background option of the constructor.

.setBackgroundColor(color)

Set the background color of the colorpicker. It also adds a 5px padding for design purpose. Param can be a hexadecimal number or an hex String.

.setNoBackground()

Removes background of the colorpicker if previously set. It's no use calling this method if you didn't set the background option or if you didn't call setBackgroundColor previously.

.onChange(callback)

Registers callback to the update event of the colorpicker. ColorPicker inherits from component/emitter so you could do the same thing by calling colorPicker.on('update');

.getColor()

Main color getter, will return a formatted color string depending on input or a number depending on the last setColor call.

.getHexString()

Returns color as css hex string (ex: '#FF0000').

.getHexNumber()

Returns color as number (ex: 0xFF0000).

.getRGB()

Returns color as {r: 255, g: 0, b: 0} object.

.getHSV()

Returns color as {h: 100, s: 1, v: 1} object.

.isDark()

Returns true if color is perceived as dark.

.isLight()

Returns true if color is perceived as light.