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! |
This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process. FREE! Go There Now!
|
|
|
|
You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve. FREE! Go There Now!
|
|
|
|
Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time. FREE! Go There Now!
|
|
|
|
Learn how you can extend modern application lifecycle management to IBM System z through the IBM Rational Software Delivery Platform (SDP). The Did you say mainframe? e-kit includes podcasts, webcasts, tutorials, white and red papers, demos, and articles designed to help ease the challenges of modernizing your enterprise. This complimentary kit for mainframe developers is a practical, how-to guide for making the most of an existing development environment, including the skills and infrastructure already in place at an established enterprise. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial of the Rational Host Access Transformation Services (HATS) Toolkit. The HATS toolkit provides a set of plug-ins for the IBM Rational Software Delivery Platform to help you easily extend your legacy applications. HATS makes your 3270 and 5250 applications available as HTML through the most popular Web browsers, while converting your host screens to a Web look and feel and it also enables you to develop new Web, portal, and rich-client applications. FREE! Go There Now!
|
|
|
|
Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started. FREE! Go There Now!
|
|
|
|
Rational Modeling Extension for Microsoft .NET enhances usability for code generation supporting a more intelligent refactoring. The latest enhancements enable organizations with Java and .NET systems and software development maintain architectural integrity across heterogeneous platforms. FREE! Go There Now!
|
|
|
|
You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online. FREE! Go There Now!
|
|
|
|
Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. FREE! Go There Now!
|
|
|
|
WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |