codice:
<%@ Language=VBScript %><%
Function rgb2hex(r,g,b)
dim strHex
strHex = ""
strHex = strHex & Right("0" & Hex(r),2)
strHex = strHex & Right("0" & Hex(g),2)
strHex = strHex & Right("0" & Hex(b),2)
strHex = "#" & strHex
rgb2hex = strHex
End Function
Function Hex2Dec(strHex)
dim i,c,d,dec
dec=0
for i=1 to Len(strHex)
c = UCase(Mid(strHex,i,1))
if isNumeric(c) then
d=CInt(c)
else
d=Asc(c)-55
end if
dec=dec+(d*(16^(Len(strHex)-i)))
next
Hex2Dec = dec
End Function
Function Hex2R(strHex)
dim inizio,hexR
inizio=1
if Left(strHex,1)="#" then inizio=inizio+1
hexR = Mid(strHex&"000000",inizio,2)
Hex2R = Hex2Dec(hexR)
End Function
Function Hex2G(strHex)
dim inizio,hexG
inizio=3
if Left(strHex,1)="#" then inizio=inizio+1
hexG = Mid(strHex&"000000",inizio,2)
Hex2G = Hex2Dec(hexG)
End Function
Function Hex2B(strHex)
dim inizio,hexB
inizio=5
if Left(strHex,1)="#" then inizio=inizio+1
hexB = Mid(strHex&"000000",inizio,2)
Hex2B = Hex2Dec(hexB)
End Function
Function CreaSfumatura(qtaColori,rda,gda,bda,ra,ga,ba)
Dim stepX,strColore,xr,xg,xb
stepX = (255/(qtaColori))
strColore = ""
for j=0 to 255 step stepX
xr = Round(j/255*ra+(255-j)/255*rda)
xg = Round(j/255*ga+(255-j)/255*gda)
xb = Round(j/255*ba+(255-j)/255*bda)
strColore = strColore & rgb2hex(xr,xg,xb) & ","
next
if strColore<>"" then strColore=Left(strColore,Len(strColore)-1)
CreaSfumatura = Split(strColore,",")
End Function
'ESEMPIO DI UTILIZZO
colore="#00FF00"
bianco="#FFFFFF"
nero="#000000"
arrayColoriChiari=CreaSfumatura(10,Hex2R(colore),Hex2G(colore),Hex2B(colore),Hex2R(bianco),Hex2G(bianco),Hex2B(bianco))
arrayColoriScuri=CreaSfumatura(10,Hex2R(colore),Hex2G(colore),Hex2B(colore),Hex2R(nero),Hex2G(nero),Hex2B(nero))
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<table>
<tr>
<td bgcolor="<%=arrayColoriScuri(8)%>">colore scurissimo</td>
<td bgcolor="<%=arrayColoriScuri(5)%>">colore più scuro</td>
<td bgcolor="<%=colore%>">colore</td>
<td bgcolor="<%=arrayColoriChiari(5)%>">colore più chiaro</td>
<td bgcolor="<%=arrayColoriChiari(8)%>">colore chiarissimo</td>
</tr>
</table>
sarebbe da rifare... ma se ti va bene comunque pigliatelo