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

jqm-simple-colorpicker

v1.0.3

Published

A simple colorpicker widget for jQuery Mobile

Downloads

6

Readme

Simple Colorpicker Widget

Coverage Status npm npm npm

This is a widget for jQuery mobile. It is an extension of the popup widget and supplies three range sliders to specify a red, green and blue value. The resulting color is shown in front of the popup.

Preview

Colorpicker Popup

Preconditions

The widget is implemented in ECMAScript 2015, so your project should support at least this version. To use the widget of course you need also jQuery and jQuery Mobile.

Installation

Installation via npm:

npm install jqm-simple-colorpicker

Download built files:

Integration

Link the CSS file nearby to your other CSS files in the header section of your HTML file:

<link rel="stylesheet" href="stylesheets/jqm-simple-colorpicker.min.css">

Include the JS file right after jQuery JS file and jQuery mobile JS file:

<script src="javascripts/jquery.min.js"></script>
<script src="javascripts/jquery.mobile.min.js"></script>
<script src="javascripts/jqm-simple-colorpicker.min.js"></script>

Usage

Definition in your HTML file

Create the colorpicker popup by adding the data-role="colorpicker" attribute to a div:

<div id="picker" data-role="colorpicker"></div>

You can use also all the attributes of the popup widget.

Options

Beside the options of the popup widget, you have following options.

defaultColor

Type: String

Default: '#000000'

You can specify a default color before opening the color picker.

// set default color to red
$('#picker').colorpicker('option', 'defaultColor', '#ff0000')

redText, greenText, blueText

Type: String

Default: 'Red', 'Green', 'Blue'

With these three options you can specify the labels for the three colors. Maybe in the language you want to provide to your user. Per default the picker uses english labels.

// change the labels to german
$('#picker').colorpicker('option', {
   redText: 'Rot',
   greenText: 'Grün',
   blueText: 'Blau'
})

Methods

Beside the methods of the popup widget, you can use following method.

color

You can get or set the current picked color.

// get picked color
var color = $('#picker').colorpicker('color')

// set picked color (to blue)
$('#picker').colorpicker('color', 'rgb(0, 0, 255)')

Events

Beside the events of the popup widget, you can register on following event.

picked

The color picker widget triggers this event even if the user applies the popup. The event handler function gets besides the event object additionally an object with the single attribute color, which contains the picked color as string in the format #rrggbb.

// register on the event
$('#picker').colorpicker('option', 'picked', function(event, data){
   // do something with data.color
}

Hints

The widget accepts two types of formats for the color (affecting option defaultColor and method color). These are:

  • '#rrggbb'

where rr is the hexadecimal value for red, gg for green and bb for blue

  • 'rgb(r, g, b)'

where r is the decimal value for red, g for green and b for blue

Example

See the manual test HTML page to get an idea how it works.

License

MIT