Git Product home page Git Product logo

eight-bit-color-picker's Introduction

Eight Bit Color Picker

UI component for picking a color from arbitrary 256 color palettes

Screenshot of color picker

This is a simple, flexible color-picker widget. It has no dependencies (not even on jQuery), so it's easy to just plug in and use. It weighs less than 3kb of combined JS & CSS once minified and gzipped.

Since it exposes itself via the UMD exports format, it will comply with whatever module loading system you're using. If you're not using one, it will expose a global called EightBitColorPicker.

If you're using Angular, there is a directive that builds on top of this that you can use.

Install

You can of course go through the old-school copy/pasta routine, but here's the incantation to pull this in using Bower:

bower install --save eight-bit-color-picker

And for those that prefer component:

component install bilalq/eight-bit-color-picker

Quick Start

You can pass in either a string of an element ID or a reference to a DOM element into the constructor of EightBitColorPicker like so:

<div id="target"></div>
// You can do this
var ebcp = new EightBitColorPicker({ el: 'target' })

// Or this
var el = document.getElementById('target')
var ebcp = new EightBitColorPicker({ el: el })

Alternatively, you can just run the detect function to find all elements with the class eight-bit-color-picker and instantiate them as pickers.

<div class="eight-bit-color-picker"></div>
<div class="eight-bit-color-picker"></div>
// Renders all color pickers
var pickers = EightBitColorPicker.detect()

Custom Palettes

The documentation goes into this in more detail, but you can easily customize the color palette on a per picker basis. For those interested in writing web apps that relate to the CLI, see this xterm-256color palette.

var customPalette = [ /* Some array of 256 hex color strings */ ]
var picker = new EightBitColorPicker({ el: 'target', palette: customPalette })

You can even update the palette of an already instantiated picker by invoking EightBitColorPicker.prototype.updatePalette.

Documentation

See this page for documentation.

Browser Requirements

This will work in all modern browsers. If you're worried about IE, this should work fine on IE10 and up.

License

MIT

eight-bit-color-picker's People

Contributors

bilalq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eight-bit-color-picker's Issues

No tests

There aren't any tests at all. I've done extensive manual testing, but I should really get some automated UI tests going. I held off in the beginning, since I didn't really know where I was going with this project, but that's no longer the case.

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.