95 lines
1.8 KiB
Plaintext
95 lines
1.8 KiB
Plaintext
<html><head>
|
|
<title>websafe.asp</title></head>
|
|
<body bgcolor="#FFFFF">
|
|
<%
|
|
whitetext="<font face='arial black' size='4' color='white'>"
|
|
blacktext="<font face='arial black' size='4'>"
|
|
colortext="<font face='arial black' size='4' color='"
|
|
|
|
spacer=" "
|
|
Response.Write blacktext & "<table border=0>"
|
|
For counter=1 To 6
|
|
safecolor1=websafe(counter)
|
|
For counter2=1 To 6
|
|
safecolor2=websafe(counter2)
|
|
For counter3= 1 To 6
|
|
safecolor3=websafe(counter3)
|
|
hexcolor=convertToHex(safecolor1,safecolor2,safecolor3)
|
|
|
|
Response.Write "<tr><td>" & hexcolor & "</td>"
|
|
|
|
|
|
Response.Write "<td bgcolor='" & hexcolor & "'>" & whitetext
|
|
Response.Write " White Text </td>"
|
|
|
|
Response.Write "<td bgcolor='" & white & "'>" & colortext & hexcolor & "'>"
|
|
Response.Write " Colored Text </font></td>"
|
|
|
|
Response.Write "<td bgcolor='" & hexcolor & "'>" & blacktext
|
|
Response.Write " Black Text </td>"
|
|
|
|
Response.Write "</tr>"
|
|
|
|
|
|
For counter4=1 To 4
|
|
Response.Write "<td bgcolor='#FFFFF'>" & spacer & "</td>"
|
|
Next
|
|
Response.Write "<tr>"
|
|
|
|
|
|
Next
|
|
Next
|
|
Next
|
|
Response.Write "</table>"
|
|
%>
|
|
</body></html>
|
|
<%
|
|
Function websafe(mynumber)
|
|
Select Case mynumber
|
|
Case 1
|
|
websafe=0
|
|
Case 2
|
|
websafe=51
|
|
Case 3
|
|
websafe=102
|
|
Case 4
|
|
websafe=153
|
|
Case 5
|
|
websafe=204
|
|
Case 6
|
|
websafe=255
|
|
End Select
|
|
End Function
|
|
%>
|
|
|
|
<script language=jscript runat=server>
|
|
Function convertToHex(R, G, B) {
|
|
|
|
var n = B;
|
|
n += G << 8;
|
|
n += R << 16;
|
|
return convertBase(n);
|
|
}
|
|
|
|
// turns Decimal Integer into hexadecimal String
|
|
Function convertBase(num) {
|
|
var i = 0; var j = 20;
|
|
var str = "#";
|
|
|
|
While(j >= 0) {
|
|
i = (num >> j)%16;
|
|
If(i >= 10) {
|
|
If(i == 10) str += "A";
|
|
Else If(i == 11) str += "B";
|
|
Else If(i == 12) str += "C";
|
|
Else If(i == 13) str += "D";
|
|
Else If(i == 14) str += "E";
|
|
Else str += "F";
|
|
} Else
|
|
str += i;
|
|
j -= 4;
|
|
}
|
|
|
|
return str;
|
|
}
|
|
</script> |