Mega Code Archive

 
Categories / Php / Graphics
 

Web Design Color Scheme Previewer- Allows uses to input hex

<? print ("<HTML><HEAD><TITLE>Website Hex Color Scheme Previewer</TITLE></HEAD>\n"); /* sets the color to maroon for the first time the users hits the page */ if ($bgColor == "") { $bgColor = "#890F01"; } if ($textColor == "") { $textColor = "#FFFFCC"; } if ($linkColor == "") { $linkColor = "#FF9966"; } if ($alinkColor == "") { $alinkColor = "#CC6633"; } if ($vlinkColor == "") { $vlinkColor = "#5AAF74"; } /* opens body using the specified background color and image unless none is given, which sets it to maroon with not background image */ if ($bgImage=="") { print ("<BODY BGCOLOR=\"$bgColor\" TEXT=\"$textColor\" LINK= \"$linkColor\" VLINK=\"$vlinkColor\" ALINK=\"$alinkColor\">\n"); } else { print ("<BODY BGCOLOR=\"$bgColor\" BACKGROUND=\"$bgImage\" TEXT= \"$textColor\" LINK=\"$linkColor\" VLINK=\"$vlinkColor\" ALINK=\"$alinkColor\">\n"); } /* **prints out the formatting table */ print ("<CENTER>\n"); print ("<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" WIDTH= \"563\">\n"); print ("<TR><TD VALIGN=\"TOP\">\n"); /* **prints out the introductory text */ print ("<CENTER><H2>Plan your Web Site's Colors</H2>\n"); print ("<H3>Website Color Scheme Previewier</H3> \n"); print ("</CENTER>\n"); print ("Simply enter in the hexidecimal or text name for the colors you wish to preview together, and then press the button below. The colors on this page will then change to the colors you have chosen, and the HTML tag will be generated below. Simply copy and paste this code into the webpage and the color scheme will be set for you."); print ("<CENTER>\n"); print ("<BR><FONT COLOR=\"$linkColor\"><B><U>Link Color</U></B></FONT>\n"); print ("<BR><FONT COLOR=\"$alinkColor\"><B><U>Active Link Color</U></B></FONT>\n"); print ("<BR><FONT COLOR=\"$vlinkColor\"><B><U>Visited Link Color</U></B></FONT>\n"); print ("</CENTER>\n"); print ("<BR><B>The HTML for this color scheme is:</B><BR><BR>"); /* ** If the user has not specified a backgound image, print the HTML body code without a background attribute */ if ($bgImage=="") { print ("<FONT SIZE=\"-1\"><BODY BGCOLOR=&quot;$bgColor&quot; TEXT=&quot; $textColor&quot; LINK=&quot;$linkColor&quot; VLINK=&quot;$vlinkColor&quot; ALINK=&quot; $alinkColor&quot;&gt;</FONT><BR><BR>"); } else { print ("<FONT SIZE=\"-1\"><BODY BGCOLOR=&quot;$bgColor&quot; BACKGROUND=&quot;$bgImage&quot; TEXT=&quot;$textColor&quot; LINK=&quot; $linkColor&quot; VLINK=&quot;$vlinkColor&quot; ALINK=&quot; $alinkColor&quot;&gt;</FONT><BR><BR>"); } /* **starts form */ print ("<FORM ACTION=\"hex.php3\" METHOD=\"POST\">\n"); /* **starts nested table */ print ("<CENTER>\n"); print ("<TABLE BORDER=\"0\" CELLPADDING=\"3\" CELLSPACING=\"6\">\n"); print ("<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">\n"); /* ** gets the users background color */ print ("<B>Background Color: </B>"); print ("</TD><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">\n"); print ("<INPUT "); print ("TYPE=\"text\" "); print ("NAME=\"bgColor\" "); print ("VALUE=\"$bgColor\">\n"); print ("</TD></TR>\n"); /* ** gets the users background image */ print ("<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">\n"); print ("<B>URL of Background Image: </B>"); print ("</TD><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">\n"); print ("<INPUT "); print ("TYPE=\"text\" "); print ("NAME=\"bgImage\" "); print ("VALUE=\"$bgImage\">\n"); print ("</TD></TR>\n"); /* **gets text color */ print ("<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">\n"); print ("<B>Text Color: </B>"); print ("</TD><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">\n"); print ("<INPUT "); print ("TYPE=\"text\" "); print ("NAME=\"textColor\" "); print ("VALUE=\"$textColor\">\n"); print ("</TD></TR>\n"); /* **gets link color */ print ("<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">\n"); print ("<B>Link Color: </B>"); print ("</TD><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">\n"); print ("<INPUT "); print ("TYPE=\"text\" "); print ("NAME=\"linkColor\" "); print ("VALUE=\"$linkColor\">\n"); print ("</TD></TR>\n"); /* **gets active link color */ print ("<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">\n"); print ("<B>Active Link Color: </B>\n"); print ("</TD><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">\n"); print ("<INPUT "); print ("TYPE=\"text\" "); print ("NAME=\"alinkColor\" "); print ("VALUE=\"$alinkColor\">\n"); print ("</TD></TR>\n"); /* **gets visited link color */ print ("<TR><TD VALIGN=\"TOP\" ALIGN=\"RIGHT\">\n"); print ("<B>Visited Link Color: </B>"); print ("</TD><TD VALIGN=\"TOP\" ALIGN=\"LEFT\">\n"); print ("<INPUT "); print ("TYPE=\"text\" "); print ("NAME=\"vlinkColor\" "); print ("VALUE=\"$vlinkColor\"><BR><BR>\n"); print ("</TD></TR>\n"); print ("<TR><TD VALIGN=\"TOP\" ALIGN=\"CENTER\" COLSPAN=\"2\">\n"); /* ** submit button */ print ("<CENTER><INPUT TYPE=\"submit\" NAME=\"Submit_Button\" VALUE= \"Preview My Colors Now!\"></CENTER>\n"); print ("</TD></TR></TABLE></CENTER>\n"); print ("</FORM>\n"); print ("</CENTER>\n"); print ("<BR><BR><BR><BR>\n"); /* **closes the formatting table */ print ("</TD></TR>\n"); print ("</TABLE>\n"); /* **closes the html page */ print ("</BODY>\n"); print ("</HTML>\n"); ?>