Click here to Skip to main content
15,895,709 members
Articles / Web Development / HTML

AWUI - a simple web user interface library with AJAX support

Rate me:
Please Sign up or sign in to vote.
4.33/5 (5 votes)
26 Jul 2007CPOL4 min read 47.9K   382   35  
An article on creating a custom JavaScript controls set and cross-browser support library
<html>
<head>
	<title>Color test</title>
	<script language="JavaScript" src="js/awui.js"></script>
	<script language="JavaScript" src="js/awui_color.js"></script>
	<style>
		 BODY {	font-family: "Trebuchet MS", Arial, Helvetica; background-color: #ffffff; font-size: 9pt;}
		 TABLE { font-size: 100%;}
		 A {color: #ff9933; text-decoration : underline;}
		 H3 { font-size: 120%;}
		 HR { height: 1px; color: #000000;}
	</style>
</head>

<body style="padding: 10;">
	<script>
	function printBox(color_) {
		AWUI.wr("<div  style='background-color: "+ color_+"; width: 220px; padding:3px;'>" + 
			color_ + ": ("+ AWUI.Color.hex2rgb(color_)+ ")" + ": ("+ AWUI.Color.rgb2hsv (AWUI.Color.hex2rgb(color_)) + ")" + "</div>");
	}
	
	function printHalftones(color_) {
		var rgb = AWUI.Color.hex2rgb(color_);
		printBox(color_);
		if (rgb == undefined) {
			return;
		}
		var hsv = AWUI.Color.rgb2hsv(rgb);
		var hsv2 = [0,0,0];
		
		hsv2 = [hsv[0], hsv[1] *0.38, Math.min(hsv[2] * 1.6, 1)];
		printBox(AWUI.Color.rgb2hex( AWUI.Color.hsv2rgb(hsv2) ));
		
		hsv2 = [hsv[0], hsv[1] *0.175, Math.min(hsv[2] * 1.7, 1)];
		printBox(AWUI.Color.rgb2hex( AWUI.Color.hsv2rgb(hsv2) ));
		
		AWUI.wr("<hr/>");
	}
	
	var color = "#008000";
	printBox(color);
	var rgb = AWUI.Color.hex2rgb(color);
	AWUI.wr("</br>hex2rgb("+ color+") = " + rgb);
	AWUI.wr("</br>hex2rgb('cc0000') = " + AWUI.Color.hex2rgb('cc0000'));
	AWUI.wr("</br>hex2rgb('ffffff') = " + AWUI.Color.hex2rgb('ffffff'));

	AWUI.wr("</br>rgb2hex(rgb) = " + AWUI.Color.rgb2hex(rgb));
	AWUI.wr("</br>rgb2hex([900,9,99]) = " + AWUI.Color.rgb2hex([900,9,99]));
	
	AWUI.wr("</br>");
	rgb = AWUI.Color.hsv2rgb(0.5,0.5,0.5);
	AWUI.wr("</br>hsv2rgb(0.5,0.5,0.5) = " + rgb);
	printBox(AWUI.Color.rgb2hex(rgb));
	
	var hsv = [1,0.5,0.5];
	AWUI.wr("</br>hsv2rgb(" + hsv+ ") = " + AWUI.Color.hsv2rgb(hsv));
	printBox(AWUI.Color.rgb2hex(AWUI.Color.hsv2rgb(hsv)));
	
	rgb = AWUI.Color.hsv2rgb(hsv);
	AWUI.wr("</br>rgb2hsv(" + rgb + ") = " + (hsv = AWUI.Color.rgb2hsv(rgb)) );
	printBox(AWUI.Color.rgb2hex( AWUI.Color.hsv2rgb(hsv) ));
	
	AWUI.wr("<h3>Blocks</h3>");
	printHalftones ("008000");
	printHalftones ("316AC5");


	
	</script>

</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Belarus Belarus
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions