Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get color palette

Status
Not open for further replies.

chicdog

Programmer
Feb 28, 2002
84
US
I want the user to be able to change the color of specified text. Is it possible to display a color palette and how do I bring back that choice?
 
Chickey --

Here is a colorpic script (from VS.NET) that shows an 8 color palette and allows the user to change the color of a text:

<SCRIPT>
function fnColorChange(){
oTitle.style.color=cp.value;
}
</SCRIPT>
<STYLE>
.colorpick{behavior: url(ColorPick.htc)}
H1 {font: bold 18pt verdana; color: navy;}
P {font: 10pt verdana;}
</STYLE>
<h1 ID=&quot;oTitle&quot;>Color Picker</h1>
<INPUT ID=&quot;oColor&quot;
TYPE=&quot;text&quot;
CLASS=&quot;colorpick&quot;
STYLE=&quot;cp--grid-size:2&quot;
onchange=&quot;fnColorChange()&quot;>

Syntax

XML N/A

HTML <INPUT type=text STYLE=&quot;behavior:url('colorpick.htc')&quot; ID=sID>
Scripting object.style.behavior = &quot;url('colorpick.htc')&quot;
object.addBehavior (&quot;colorpick.htc&quot;)

Possible Values

sID String that specifies a unique identifier for the object.

The code for the colorpick.htc can be found under MSDN's DHTML Behaviors library, and a sample is available there. This is one procedure, that uses javascript to accomplish a color change.

 
Thanks for the help. Is there a way to get more than just 8 colors?
 
Chickey - print out the code for colorpick.htc (MSDN's DHTML Behaviors library) - I'm sure you could modify it to include additional colors. I don't have the link but I remember that the full source code for colorpick.htc is available.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top