216 color table. PHP adn HTML & CSS.
By : sanchir
<html>
<head>
<title>Color</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
font-size: 7pt;
font-family: "verdana";
SCROLLBAR-FACE-COLOR: #FFFFFF;
SCROLLBAR-HIGHLIGHT-COLOR: #FFFFFF;
SCROLLBAR-SHADOW-COLOR: #FFFFFF;
SCROLLBAR-3D-LIGHT-COLOR: #FFFFFF;
SCROLLBAR-ARROW-COLOR: #FFFFFF;
SCROLLBAR-TRACK-COLOR: #FFFFFF;
SCROLLBAR-DARK-SHADOW-COLOR: #FFFFFF;
SCROLLBAR-BORDER: 0px;
}
td {
font-size: 11pt;
font-family: "verdana";
}
a {
font-size: 11pt;
font-family: "verdana";
}
input {
font-size: 7pt;
font-family: "verdana";
}
</style>
<script language="JavaScript">
function setColor(color) {
document.form.color_hex.value = "#"+color;
document.form.color.style.backgroundColor = "#"+color;
}
</script>
</head>
<body bgcolor="" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<?php
// color cell fill
$fill = " ";
$col_r = 0; // red color
$col_g = 0; // green color
$col_b = 0; // blue color
$row_return = 0;
$block_return = 0;
echo "<table border='0' cellspacing='3' cellpadding='0' align='center'>
<thead><th colspan='3'>216 Colours Pallete</th></thead><tr>";
while($col_r <= 255) {
$col_g = 0;
echo "<td>";
$block_return++;
while($col_g <= 255) {
$col_b = 0;
while($col_b <= 255) {
$red = strtoupper(dechex($col_r));
$green = strtoupper(dechex($col_g));
$blue = strtoupper(dechex($col_b));
$color = str_pad($red, 2, '0', STR_PAD_LEFT)."".str_pad($green, 2, '0', STR_PAD_LEFT)."".str_pad($blue, 2, '0', STR_PAD_LEFT);
?>
<a onMouseDown="setColor('<?php echo $color ?>')" style="cursor: hand; background: #<?php echo $color ?>;"><?php echo $fill; ?></a>
<?php
// Form the row of 6 colors...
$row_return++;
if($row_return==6) {
echo "<br>";
$row_return = 0;
}
$col_b+=51; // decrement for more colors, but be carefull, there are over 16 Million colors
}
$col_g+=51; // decrement for more colors, but be carefull, there are over 16 Million colors
}
$col_r+=51; // decrement for more colors, but be carefull, there are over 16 Million colors
// deal with the end rows in order to display the colors in a table...
if($block_return == 3) {
echo "</td></tr><tr>";
}else {
echo "</td>";
}
}
echo "</tr></table>"; // end row & table
// Display the Grey colors
$col = 16;
echo "<div align=\"center\">";
echo "<h4>Greyscale</h4>";
while($col <= 255) {
$red = strtoupper(dechex($col));
$green = strtoupper(dechex($col));
$blue = strtoupper(dechex($col));
$color = str_pad($red, 2, '0', STR_PAD_LEFT)."".str_pad($green, 2, '0', STR_PAD_LEFT)."".str_pad($blue, 2, '0', STR_PAD_LEFT);
?>
<a onMouseDown="setColor('<?php echo $color ?>')" style="cursor: hand; background: #<?php echo $color ?>;"><?php echo $fill; ?></a>
<?php
$col +=16;
}
echo "</div>";
?>
<center>
<form name="form">
Hex Value:
<input type="text" name="color_hex" size="10"><br>
<textarea cols="40" rows="10" name="color" style="background: white; border: 0;" disabled></textarea>
</form>
</center>
</body>
</html>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Content Management Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
Hold your calendar on January 30, 2008 for this free webcast on the new i5/OS. Rational's Enterprise Modernization products will be discussed at this webcast as they help to drive the application development environment for this new System i OS. <br />And learn how i5/OS will take you to the next step of efficient, resilient business processing. You will hear about the new i5/OS capabilities as it will be the most significant i5/OS release in years. If you cannot join the webcast on 1/30/08 you can still use this link to listen to the replay.<br /> FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development FREE! Go There Now!
|
|
|
|
Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base. FREE! Go There Now!
|
|
|
|
Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations. FREE! Go There Now!
|
|
|
|
Join us for this web seminar to learn how you can defend your web applications from attack. Learn about the 3 most common web application attacks, including how they occur and what can be done to prevent them. We’ll also discuss manual versus automated approaches for scanning and identifying web application vulnerabilities and how IBM Rational AppScan, an automated vulnerability scanner, can help you automate more of what you are doing manually today. FREE! Go There Now!
|
|
|
|
In this tutorial, you can learn how to install and configure the IBM Rational Asset Manager Eclipse client, explore the different views in the Asset Management perspective, learn various search techniques, work with existing assets, and submit a new asset. FREE! Go There Now!
|
|
|
|
IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
|
|
|
|
Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development. FREE! Go There Now!
|
|
|
|
In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |