colorBar

JavaScript ColorPicker 0.6

This colorPicker is a light weight all-rounder (only ~46k incl. all 13 files (gzip compressed ~28.6kB)) that can display and let you choose the entire color palette (~16.78 mil. colors) in 6 different color modes: HSB (HSV / HSL) mode and RGB mode (+3 extra modes in RGB).
This highly customizable and easy to install app comes in 4 different sizes (from 151 x 87 pixels to
405 x 302 pixels) and therefore different feature levels so you can use it for every supposable cause from 'easy choice' to 'professional determination'. That's probably all you'll ever need to let your clients choose the right color.
You'll also find a lot of extra helpers and smart features like contrast-meter, color-difference-meter, value-slider in input fields, web-smart and web-save button, color memories and much more that can help your clients make the right decision. Read about the main features to see all the extras.

app_3D

Table of contents:

Bookmark and Share

The following screenshots are numbered consecutively in a little graphic in the middle (1 to 11 as red numbers). The explanations below use those numbers as a reference to these pictures.
colorPickers
click here or on image to see it full (real) size.

^ back to top

Main features:

^ back to top

Demo & operating instructions:

Here you can see a demo of the colorPicker 0.7 (see gray box below).
Assuming that you understand a little bit of 24-bit RGB-colors, these instructions will help you to understand how to mix colors and therefore chose them out of ~16.78 million colors.

So, go ahead and click here: (input field has attribute: onclick="colorPicker(this)")

If you want to know how picking colors of an image works: click here

The color comparison is not only about contrast but also about "when viewed by someone having color deficits or when viewed on a black and white screen"... so, sorry for the green, orange, red indicator ;o)
See also : W3C: foreground and background color combinations.
This does not include being compliant to the WCAG 2 AA or WCAG 2 AAA standard.

Get a deeper understanding (in real english ;o) about device-dependent RGB models at:
http://en.wikipedia.org/wiki/HSL_and_HSV or visit John Dyer's page for some nice tutorials.
There is also a tool that helps understanding at http://dematte.at/cp2/ or http://dematte.at/cp3/

^ back to top

Methodes and Attributes:

There are some attributes and methodes available if you called the picker like
'var cP = new colorPicker(this)'

Those attributes can also be set on startup like for example:
onclick = "colorPicker(this, '#c67', false, 'HSB_S', 3, false, true,....)"
in the order of the above attribute list. This way there is no 'init()' needed.

^ back to top

Download (ver. 0.7 beta):

For now you can download the .zip File (~20kB) here.
To install:
 
<script type="text/javascript" src="colorPicker/colorPicker.js"></script>
 
...in the head of your document and...
 
<input onclick="colorPicker(this)" value="#CC0000" />
 
...somewhere else

You can also use onmouseover instead and use a <div>or something else instead of <input>.
There are still some uneaven parts that have to be recoded,... (as soon as I've time for that ;o)

Be aware that this colorPicker only runs from a server and not local (offline).
If you need it as a stand alone version, just let me know... it's certainly also possible,... although you'll loose the ability to reskin it (but it might even load faster and loose some weight - up to 7k maybe, so it's then only 39k and only 8 files instead of 13).

This colorPicker is still in beta, so please, if you find anything I could change or make better,... please let me know: colorPicker@dematte.at
Gettin feedback always motivates and make things going. (so you'll benefit from it too ;o)

If you need more (better) instructions than let me also know... then I'll rewrite them.

^ back to top

(Possible) future features (maybe):

^ back to top

Usage / Details of (some) features:

Installation: is as easy as including the colorPicker.js as usual in the header of your page (<script type="text/javascript" src="colorPicker/colorPicker.js"></script>)
Usage: and then call it the like, onclick="colorPicker(this)" inline or with any other method..

Customization: you have loads of parameters that you can send to your newly created object, at the time you call it, like onclick="var myCP=new colorPicker(this, cPSubDir, cPHTMLFile, cPCSSFile, cPSize, colorMode, color, slLoGrade, slHiGrade...) or like myCP.cPSubDir = 'mySubDir'; etc... and then start it with myCP.init();
The parameters are for:

RGB mode: these modes use an additional special feature. The right button next to the input fields (see screenshot 10, the button is up) in RGB modes let you turn on/off the true color mode.
In off-mode you can only see the grade of adding that specific color to the others to the left pane (from black=none to e.g. green=full). This way it might be more understandable for 'newbies' how color mixing works.

Separate cursors: the right, vertical slider has 2 separate indicators (or cursors). While dragging, the right one stays where it was before dragging to give a better understanding how fare off the last choice was to the upcoming. These two cursors react also separate to contrast adjustment (see screenshot 7 and 10)
The far right square of the color memories also keeps the last picked color so you can compare it with the current color.

Colors and state memories: the colors you choose can be stored in the nine (black at first startup) squares at the left bottom of your colorPicker. the 10th square shows the picked color after dragging and fills up the memory with the current color if clicked. These colors can then be recalled by clicking on the desired slot (square).
If you choose a color twice or you chose one of the stored colors and want to save it again, a blinking of the equivalent square will indicate that this color already exists and ignores the request. The blinking is also contrast dependent (dark-gray for light colors and light-gray for dark colors).
The memory also keeps the state of the application: size (scaling) and color modes (HSB, RGB and RGB easyMode).

Skin able: This app uses a technique that can separate HTML and CSS from javaScript. This way it is possible to make the whole thing look totally different, so called skin able, by screen designers that have no clue about programming. There are just some rules that have to be obtained, like: don't rename or delete existing class-declarations, ... that was it actually.

Web-save colors: in the screenshots you see the button with an '?' instead of an 'W'. That's because the pictures I used were old. Clicking it changes the colorPicker in a mode that on mouseUp it recalculates the closest web-save color and moves the cursor(s) there.

Files and sizes: this app needs 12 (IE - 13) files (all together approximately 46k):
1 javaScript (~30kB), 1 HTML, 1 CSS for all different scaling sizes, 1 transparent cursor, (1 transparent pixel GIF for IE), 1 icon png for the design and 8 PNGs for displaying wonderful colors (most of them only 1 or 2 pixels wide or high). As mentioned before, there is the HTML file and its CSS that makes designing the UI easier.

^ back to top

Techniques (and what I learned with this project)

Even though programming a colorPicker seems to be the most boring and stupid thing to do, I had my reasons and needs to do this for an other project and while learning different techniques (not only JS) I wanted to combine everything in one.... and here it is. (great thanks to Peter-Paul Koch, the guy who runs this wonderful web-site http://quirksmode.org/, for actually teaching me javaScript ;o)
I was (am) pretty new to javaScript and used it very spartanic, most of the time not really knowing and understanding what was going on,... but still somehow working, so I was (kind of) happy with what I got. This experimenting most of the time can also be very frustrating though,... so I decided to do this project and learn javaScript (maybe also because I once failed at a job-interview at a company because of the lack of JS-knowledge).
 

...details and tutorials will follow...
 
I've used so many different useful techniques in here that I planned on writing several tutorials for some every day usage. Some techniques might not seem so obviously being needed in other apps,... you would think, but I'll show you some other application areas as well.

The tutorials will be about:

In the future I'll also present some tutorials for:

... so, see you soon ;o)

^ back to top
dematte
madeinheaven  branch office Amsterdam