rgbaColorPicker now up on GitHub

Earlier this week I needed a color picker, but not just any color picker, I needed one with alpha level transparency support. After searching for a while and finding nothing I decided to create my own. Outside of just doing alpha it also supports colors names and converts colors using tinycolors.js.

Instead of going over the code like I usually do I decided just to put it up on github (rgbaColorPicker on GitHub), that way if anybody can make changes and they can be reintegrated into the master branch. There are some examples of the script up on this site, you can view them here:

You can use the rgbaColorPicker by including the require files (rgbacolorpicker.js and tinycolor-min.js) and either including the seperate stylesheet or adding the styles from it to your existing stylesheet. Then, create an input element and give it the class color picker, the script will do the rest.

As you select a color it will return the value to the input, either as the html color name, the the Hex value, or if there is an alpha as rgba.

This version is pretty basic, but future plans include making it only require a single fine, and giving more options, any suggestion can be posted here, or you can fork the github project and add them yourself and I’ll integrate them if you’d like. For those not interested in the whole github thing, you can get a direct download of the script GitHub rgbaColorPicker Download page.

Some test data for today, HTML colors and the ZIP code database.

Earlier today I was looking for some test data, some specific test data, and though I’d share it, along with another set of data I’ve used a few times (and not only for testing). First some color test data, this PHP array contains ever html color with a name, along with it’s corresponding hex color. This was actually pulled from tinycolor.js, which I was looking through to add something to.

Next I’ve attached (since it’s far to large to paste) a mysql file containing every ZIP code, although with corresponding city, state, lat, long, population, and a bunch of other data. Just upload the attached file and have a ball.

zip_code_db.sql.zip

I did some work on something else that might get posted this weekend, but will probably not make an appearance till next week.

CSS Colorizer Update

I noticed a few quirks in the CSS colorizer, so I made an update. This will now grab any HEX color code in the same declaration, no matter where it is. That means that you can use it to change compact background with image styles or border colors. Also added a catch for the “transparent” keyword it’ll catch that as well. Code is below, snipplrs been updated.

The changes only take place in the regular expressions, specifically the second one. Leave any new feedback in the comments and I’ll keep making changes as needed.