Skip to content

gthmb/jquery-miniColors

 
 

Repository files navigation

jQuery miniColors: A small color selector

Copyright 2011 Cory LaViska for A Beautiful Site, LLC. (http://abeautifulsite.net/)

Dual licensed under the MIT / GPLv2 licenses

Demo

http://labs.abeautifulsite.net/jquery-miniColors/

Usage

  1. Link to jQuery: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  2. Link to miniColors: <script type="text/javascript" src="jquery.miniColors.js"></script>
  3. Include miniColors stylesheet: <link type="text/css" rel="stylesheet" href="jquery.miniColors.css" />
  4. Apply $([selector]).miniColors() to one or more INPUT elements

Options

  • disabled [true,false] - Disables the control on init
  • readonly [true,false] - Makes the control read-only on init

Specify options on creation:

$([selector]).miniColors({
	optionName: value,
	optionName: value,
	...
});

Methods

Methods are called using this syntax:

$([selector]).miniColors('methodName', [value]);

Available Methods

  • letterCase [uppercase|lowercase|null] - forces the hex value into upper or lowercase
  • disabled [true|false] - sets the disabled status
  • readonly [true|false] - sets the readonly status
  • value (none) - gets the current value; guaranteed to return a valid hex color
  • value [hex value] - sets the control's value
  • destroy (none)

Events

  • change(hex, rgb) - called when the color value changes
  • open(hex, rgb) - called when the color picker is opened
  • close(hex, rgb) - called when the color picker is hidden

In all callbacks, 'this' refers to the original input element

Example

$([selector]).miniColors({
	change: function(hex, rgb) { ... }
});

Attribution

About

jQuery MiniColors Plugin

Resources

Stars

Watchers

Forks

Packages

No packages published