Git Product home page Git Product logo

palette-color's Introduction

Palette Color

This Jquery Plugin is a simple palette color. See a demo.

Palette Color

Usage

<script src='palette.js'></script>
<link rel='stylesheet' href='palette.css' />

<div id="colorpicker"></div>

<script>
    var $palette = $("#colorpicker").paletteColor({
  		palette: [["#FFC0CB", "#FF99CC", "#FF6699", "#FF3366"],
                  ["#FFEFD5", "#FFCC33", "#FF9900", "#FF9933"],
                  ["#FFEACD", "#FFFF99", "#FFFF66", "#FFD700"],
                  ["#CCFFCC", "#CCFF66", "#99FF00", "#99CC00"]]
  		});
    $palette.paletteColor("position", {x:100, y:100});
    $palette.paletteColor("onColorSelected", function(color){
      console.log(color);
    });
</script>

Build

  • Fix dependencies. In palette color folder root:
   npm install -g grunt-cli
   npm install
  • Build:
   grunt

Docs

Initialize palette color options

       $("#colorpicker").paletteColor({
            cellWidth: 12,
            cellHeight: 12,
      	  	recentLabel: "<b> Recent Colors Selected</b>",
            recentPalette: ['white', 'white'],
            palette: [['red', 'blue'], ['green', 'orange']]    
        });
  • cellWidth
    type: interger
    description: width of color cell

  • cellHeight
    type: interger
    description: height of color cell

  • recentLabel
    type: string
    description: the title that appear on recent colors

  • recentPalatte
    type: array
    description: Colors array that init recent colors

  • palette
    type: array
    description: A multidimensional color array that contain the colors of the palette

Show or hide

  • value
    type: boolean
      var value = true;
      $("#colorpicker").paletteColor("show", value);
           

Enable or disable drag

  • value
    type: boolean
      var value = true;
      $("#colorpicker").paletteColor("dragable", value);
           

Set position

  • position
    type: {x:float, y: float}
      var position = {x: 120, y: 230};
      $("#colorpicker").paletteColor("position", position);
           

Event when color selected

  • action
    type: function
      var action = function(color){
        console.log(color);
      };
      $("#colorpicker").paletteColor("onColorSelected", action);
           

License

The MIT License.

palette-color's People

Contributors

laerciosantana avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.