Giter Site home page Giter Site logo

xiaoshangmin / color-picker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vual/color-picker

0.0 0.0 0.0 19.76 MB

微信小程序拾色器(颜色选择器或取色器)组件,快速获取颜色值,小程序原生语法,方便集成。

License: Apache License 2.0

JavaScript 100.00%

color-picker's Introduction

color-picker

微信小程序拾色器(颜色选择器或取色器)组件,快速获取颜色值,小程序原生语法,方便集成。

项目仓库地址:

github

gitee

功能介绍

1.点击颜色盒子,直接选择颜色。
2.调节颜色条。
3.调节透明度。
4.调节RGB值。
5.直接点击备选颜色。

使用方式

1.json里引入控件:

"usingComponents": {
    "color-picker": "/components/color-picker/color-picker"
}

2.定义Page:

Page({
    data: {
        colorPickerShow: false,
        defaultColor: {
            r: 0,
            g: 0,
            b: 255,
            a: 1
        },
        rgba: {
            r: 0,
            g: 188,
            b: 212,
            a: 1
        }
    },

    onLoad() {
    
    },

    openPicker() {
        this.setData({
            colorPickerShow: true,
        })
    },
    
    colorConfirm(event) {
        this.setData({
            rgba: event.detail.rgba
        })
    }
})

3.编写页面:

<view class="color-button">
    <button bind:tap="openPicker" style="background-color: rgba({{rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + rgba.a}})">选择颜色</button>
    <color-picker show="{{colorPickerShow}}" defaultColor="{{defaultColor}}" bind:confirm="colorConfirm"></color-picker>
</view>

演示

image

color-picker's People

Contributors

vual 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.