ti2 / css3-colorpicker Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gruppler/css3-colorpicker
A CSS3 color picker
Home Page: http://gruppler.blogspot.com/search/label/colorpicker
This project forked from gruppler/css3-colorpicker
A CSS3 color picker
Home Page: http://gruppler.blogspot.com/search/label/colorpicker
CSS3 ColorPicker (https://github.com/gruppler/CSS3-Colorpicker) v1.3.2 Copyright (c) 2011 Craig Laparo (https://plus.google.com/114746898337682206892) Based on "PhotoShop-like JavaScript Color Picker" Copyright (c) 2007 John Dyer (http://johndyer.name) MIT style license Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================================================ Usage: Include these in your header: <link rel="stylesheet" type="text/css" href="colorpicker.css"/> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="colorpicker.js"></script> Apply to your selection: // Default options $(".selector").colorpicker(); // Custom options $(".selector").colorpicker({ realtime: false, invertControls: false, controlStyle: 'raised' }); -------------------------------------------------------------------------------- Options: showAnim: true // [true|false] to enable/disable animations duration: 200 // Fade duration color: 'FFF' // Default color allowNull: false // [true|false] to allow an empty color value; // otherwise default to the default color realtime: true // [true|false] to enable/disable instant updates invertControls: true // [true|false] to enable/disable inverting color // of mouse controls based on luminance controlStyle: 'simple' // Mouse control theme [simple|raised|inset]; // separate multiple themes with a space swatches: true // [true|false] to enable/disable, // or an array of hex codes to pre-fill alpha: false // [true|false] to enable/disable alpha alphaHex: false // [true|false] to enable/disable 4-byte hex // in the format '#AARRGGBB' Options can be retrieved or changed at any time: // Get option's current value $(".selector").colorpicker("option", "color"); // Set option $(".selector").colorpicker("option", "color", "fff"); -------------------------------------------------------------------------------- Events: beforeShow(input, inst) // Fired before the color picker is shown onClose(color, inst) // Fired when the color picker is hidden onSelect(color, inst) // Fired when the color is set onAddSwatch(color, swatches) // Fired when a new color swatch is added Event handlers can be set just like options: // At initialization $(".selector").colorpicker({ onSelect: function(color, inst){...} }); // After initialization $(".selector").colorpicker('option', 'onSelect', function(color, inst){...}); -------------------------------------------------------------------------------- Public Methods: setDefaults(settings) // Set the defaults for all color pickers addSwatch(color, newOnly) // Add a color or array of colors to the swatches; // preserve sorting if 'newOnly' is true clearSwatches() // Remove all swatches refresh() // Update the color picker color(args) // A useful color class hexToRgb(hex, alphaOn) // Returns {r:[0-255], g:[0-255], b:[0-255], a:[0-100]} validateHex(hex, norm, alphaOn) // Returns a valid hex code, // optionally normalized rgbToHex(rgb, alphaOn) // rgb = {r:[0-255], g:[0-255], b:[0-255], [a:[0-100]]} intToHex(dec) // Base conversion from 10 to 16 hextToInt(hex) // Base conversion from 16 to 10 rgbToLum(rgb) // rgb = {r:[0-255], g:[0-255], b:[0-255]} // Returns integer [0-100] rgbToHsv(rgb) // rgb = {r:[0-255], g:[0-255], b:[0-255]} // Returns {h:[0-359], s:[0-100], v:[0-100]} hsvToRgb(rgb) // hsv = {h:[0-359], s:[0-100], v:[0-100]} // Returns {r:[0-255], g:[0-255], b:[0-255]} To use a public method, call it like this: // Validate 'hex' $.colorpicker.validateHex('hex'); // Create a color object var myColor = new $.colorpicker.color({hex: 'ccc'});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.