Jump to content
xisto Community
Sign in to follow this  
iGuest

A color palette for Forum Post

Recommended Posts

http://forums.xisto.com/no_longer_exists/

It's very useful,I'm sure.
Main Script
function my_getbyid(id){	itm = null;	if (document.getElementById){  itm = document.getElementById(id);	}	else if (document.all){  itm = document.all[id];	}	else if (document.layers){  itm = document.layers[id];	}	return itm;}function insertTag(MyString){	fontbegin='[color=' + MyString + ']';	fontend='[/color]';	addcontent(fontbegin,fontend);}function RGB2Hexa(TR,TG,TB){	return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);}function dec2Hexa(number){	var base_hexa = "0123456789ABCDEF";	return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);}function lightCase(MyObject,objName){	my_getbyid(objName).bgColor = MyObject.bgColor;}function rgb(pas,w,h){	col = new Array;	col[0] = new Array(255,0,255,-1,255,-1);	col[1] = new Array(255,0,0,1,0,0);	col[2] = new Array(255,-1,255,0,0,0);	col[3] = new Array(0,0,255,0,0,1);	col[4] = new Array(0,0,255,-1,255,0);	col[5] = new Array(0,1,0,0,255,0);	col[6] = new Array(255,-1,0,0,255,-1);	for (j=0;j<6+1;j++)	{  for (i=0;i<pas+1;i++)  {  	r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);  	g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);  	b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);  	codehex = r + '' + g + '' + b;  	document.write('<td bgColor="' + RGB2Hexa(r,g,b) + '"onmouseover="lightCase(this,'ColorUsed')" onclick="insertTag(this.bgColor)" width="'+w+'" height="'+h+'"><IMG height='+h+' width='+w+' border=0 title="Color:'+RGB2Hexa(r,g,b)+'"></TD>n');  }	}}
Then add the code below to the place where the color palette need take.
<table cellspacing="0" cellpadding="0" align="left" border="0">    <tr>        <td id="ColorUsed" onclick="if(this.bgColor.length > 0) addcontent('[color='+this.bgColor+']','[/color]')" valign="center" align="middle">            <img height="10" width="20" border="1">        </td>        <script>rgb(80,1,10)</script>        <!--rgb(width,1,height)//-->    </tr></table>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.