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! |
XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. FREE! Go There Now!
|
|
|
|
David Barnes, Lead Evangelist for IBM Emerging Internet Technologies 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!
|
|
|
|
Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications. FREE! Go There Now!
|
|
|
|
Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services. 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!
|
|
|
|
Discover how Rational tools and best practices for testing can make your job easier. The new Rational Testing eKits provide you with valuable resources – including demos, webcasts, tutorials, and articles – that help you address your specific testing needs across the software lifecycle. Five new eKits are available covering the topics of Requirements and Test Management, Functional Testing, Performance Testing, Code Quality and Embedded Systems, and SOA and Web Services Testing. FREE! Go There Now!
|
|
|
|
Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications. FREE! Go There Now!
|
|
|
|
Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference, to hear how Enterprise Generation Language (EGL) eliminates the need for tedious and error-prone low level coding, so developers can focus on business requirements. EGL extends the Rational software development platform with a simplified programming language that enables developers who have little or no experience with Java, Web technologies or Service Oriented Architecture, to create enterprise-class applications and services quickly and easily. It also allows developers who may have little or no mainframe programming experience to quickly create traditional mainframe components. FREE! Go There Now!
|
|
|
|
As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |