Giter VIP home page Giter VIP logo

color-picker's Introduction

Color Picker

一款简易的拾色器插件,功能如下:

  • 获取 RGB\HEX 值;
  • 色值改变时执行回调;

安装

<script src="color-picker.js"></script>
插件需要 jQuery 支持,请确保页面中有使用 jQuery

使用

一般用法:

// 将拾色器放入 dom 元素中并初始化
colorPicker.init(dom)

// 获取拾色器当前 RGB 值
colorPicker.getRGB()

设置色值变化回调函数:

colorPicker.init(dom, function (rgb, hex) {
  console.log(rgb, hex)
})

回调函数有两个参数分别为实时颜色的 RGB 值和 16 进制值。

方法

方法 参数 说明
init [Object][, Function] 初始化函数,返回拾色器元素
getRGB - 获取当前颜色的 RGB 值
getHEX - 获取当前颜色的 16 进制值
destory - 销毁拾色器

Thanks

color-picker's People

Contributors

ajccom avatar

Stargazers

 avatar

Watchers

 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.