PDA

View Full Version : ColorPicker for hex codes


davidw
06-21-2006, 10:00 PM
Ok, here's another small hack that I threw together. It should be an easy one. I have tested this in both Firefox and IE and both work - other than those two I don't know.

This is handy for a website that allows its members to choose a color for anything - for example: allowing the user to change their username color (I used a hack for this).

I would rate this an easy modification - most everyone should be able to install this.

Don't forget to change www.yourwebsite.com with your domain name/location.

Step 1: Upload the entire ColorPicker folder to your website - remember where you have uploaded it to. The best place for this is in your root folder as in http://www.yourwebsite.com/ColorPicker/

Step 2: Create a reference to the colorpicker however you choose.

Add a reference from any page:

FIND:
</head>
ADD BEFORE
<SCRIPT LANGUAGE="JavaScript">
<!-- Idea by: Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL: http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,men ubar=0,resizable=0,width=440,height=510,left = 440,top = 287');");
}
// End -->
</script>
Find the location on the page where you want to add the link and then do one of the following

For a button, add this:

<form><input type=button value="Open the Popup Window" onClick="javascript:popUp('http://www.yourwebsite.com/ColorPicker/colorpicker.php')"></form>
For a javascript text link, add this:

<A HREF="javascript:popUp('http://www.yourwebsite.com/ColorPicker/colorpicker.php')">Open the Popup Window</A>

Ultimately, you could directly link the page itself (located in the folder).

Temporary demo location:
http://www.christianboards.org/popup.php

All I did was make use of the reference location edits (above) and put them in a fresh php file.

projectego
06-22-2006, 07:11 PM
Very useful tool. Thanks for sharing, christianb. :)

Jeordie015
06-22-2006, 09:28 PM
Ooh. This could really come in handy. I was always wanting something like this. But is there something similar, but not something that is a Java applet? Like a simple 256 color picker?

davidw
06-22-2006, 10:34 PM
I'm not sure - I've been looking for a long time and when I found this (for free / no strings - but leave author information, etc.) I jumped on it. You could essentially find another colorpicker.class file that is free for use on a website and alter it that way. I was actually looking for something a little less profile (smaller) to use, but I figure for now - this was decent enough. :D

davidw
12-14-2008, 01:08 PM
This modification is no longer supported.
This modification has been marked re-usable.