Skip to content

supersimple/jquery-miniColors

 
 

Repository files navigation

Super Simple Color Picker

Updated by: Todd Resudek http://supersimple.org

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

Dual licensed under the MIT / GPLv2 licenses

Demo

http://supersimple.org/color-picker

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
  • predefined-colors [array] - Makes thumbnails in selector window for colors you preset

Specify options on creation:

var predefinedColors = new Array('#eeeeee','#5fd2e6','#7daf3c','#f0910a','#be1414','#8c1ed2','#325fc8','#6a360e','#d7d746','#222222','#f1919f');
$([selector]).miniColors(predefinedColors);

or

$([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; '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

Languages

  • JavaScript 100.0%