You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/08/18 21:23:11 UTC

svn commit: r432729 - /incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js

Author: mturyn
Date: Fri Aug 18 14:23:10 2006
New Revision: 432729

URL: http://svn.apache.org/viewvc?rev=432729&view=rev
Log:
Displays colour values better now.

Modified:
    incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js

Modified: incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js?rev=432729&r1=432728&r2=432729&view=diff
==============================================================================
--- incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js (original)
+++ incubator/xap/trunk/WebContent/examples/dojo/colorPickerHandler.js Fri Aug 18 14:23:10 2006
@@ -24,25 +24,31 @@
 	var rgbInv = {r:0xFF^rgb.r, g:0xFF^rgb.g, b:0xFF^rgb.b } ;
 	var displayer = document.getElementById("displayColour") ;
 	
+	for( var col in rgbInv){
+		rgbInv[col] =  rgbInv[col].toString(16) ;
+		// Zero-pad:
+		if (rgbInv[col].length==1){
+			rgbInv[col] = "0" + rgbInv[col] ;		
+		}
+	}
 
-
-
+	var colourInv ="#" +rgbInv.r +rgbInv.g +rgbInv.b ;
 	
 	
 
-		var str = "<font size=\"+2\" weight=\"bold\" face=\"Garamond\" "
+		var str = "<font size=\"+2\" face=\"Garamond\" "
 									+">Picked : "
 									+ "<font "									
-									+ " color=\""+colour +"\""																		
+									+ " color=\""+colourInv +"\""																		
 									+" >"
-									+ "<div style=\"width:4em;text-align:center;background:rgb(" + rgbInv.r + "," + rgbInv.g + "," +rgbInv.b +")\">"										
-									+colour
+									+ "<div style=\"width:4em;text-align:center;background:rgb(" + rgb.r + "," + rgb.g + "," +rgb.b +")\">"										
+									+"<b>"+colour+"</b>"
 									+ "</div>" 
 									+"</font>"
 									+"&nbsp;= <b>rgb("
-									+"<font color=\" #"+rgbHex.r+"0000\">" +rgb.r +"</font>,"
-									+"<font color=\" #00"+rgbHex.g+"00\">" +rgb.g +"</font>,"
-									+"<font color=\" #0000"+rgbHex.b+"\">" +rgb.b +"</font>"
+									+"<font color=\" #"+(rgbHex.r)+"0000\">" +rgb.r +"</font>,"
+									+"<font color=\" #00"+(rgbHex.g)+"00\">" +rgb.g +"</font>,"
+									+"<font color=\" #0000"+(rgbHex.b)+"\">" +rgb.b +"</font>"
 									+")</b>"
 									+"</font></font>" ;
 		displayer.innerHTML =str ;