DIR : /home/kozerus/public_html/pn/uize/site-source/examples/color-picker.html

/home/kozerus/public_html/pn/uize/site-source/examples

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Color Picker | JavaScript Examples | UIZE JavaScript Framework</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta name="keywords" content="color touch ipad Uize.Widgets.RgbSliders.Widget"/>
	<meta name="description" content="See how three RGB sliders widgets - with sliders for red, green, and blue - can be used to tweak text color, background color, and border color."/>
	<link rel="alternate" type="application/rss+xml" title="UIZE JavaScript Framework - Latest News" href="http://www.uize.com/latest-news.rss"/>
	<link rel="stylesheet" href="../css/page.css"/>
	<link rel="stylesheet" href="../css/page.example.css"/>
	<style>
		.pickerSpacer {
			width:15px;
		}
	</style>
</head>

<body>

<script type="text/javascript" src="../js/Uize.js"></script>

<h1 class="header">
	<a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
	<a href="../index.html" class="homeLinkText" title="UIZE JavaScript Framework home">UIZE JavaScript Framework</a>
</h1>

<div class="main">
	<h1 class="document-title">
		<a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
		Color Picker
		<div class="pageActionsShell">
			<div id="page-actions" class="pageActions"><a href="source-code/color-picker.html" class="buttonLink">SOURCE</a></div>
		</div>
	</h1>

	<!-- explanation copy -->

	<div class="explanation">
		<p>In this example, three instances of <a href="../reference/Uize.Widgets.RgbSliders.Widget.html"><code>Uize.Widgets.RgbSliders.Widget</code></a> are created, to control the text color, background color, and border color of the sample text to the left. Each color picker has a color swatch above the sliders, representing the current color selected by it.</p>
	</div>

	<!-- "wireframe" for the UI -->

	<table border="0" cellspacing="0" cellpadding="0" style="margin:auto;">
		<tr>
			<td class="heading">Sample Area</td>
			<td class="pickerSpacer"></td>
			<td class="heading">Text</td>
			<td class="pickerSpacer"></td>
			<td class="heading">Background</td>
			<td class="pickerSpacer"></td>
			<td class="heading">Border</td>
		</tr>
		<tr>
			<td id="page-sampleNode" style="width:300px; border:10px solid; padding:10px;">
				I'd like to see the companies that make up the <b>new energy economy</b> gang up on the bloated fossil fuel giants like a bunch of vicious attack dogs and <b>rip</b> their corporate throats out.<br/>
				<br/>
				Then, once the kill is complete, may they rip through the <b>bloated bellies</b> of the fallen giants, to feast upon their oily entrails.<br/>
				<br/>
				And from feeding upon these fattened pigs, let the <b>age of renewable energy</b> truly dawn.<br/>
				<br/>
				We have seen a Silicon Valley giant born in this way, and advertising will never be the same again.<br/>
				<br/>
				May the same <b>fate</b> befall the entrenched and recalcitrant fossil energy giants.<br/>
			</td>
			<td></td>
			<td id="page-colorPicker"></td>
			<td></td>
			<td id="page-backgroundColorPicker"></td>
			<td></td>
			<td id="page-borderColorPicker"></td>
		</tr>
	</table>
</div>

<!-- JavaScript code to make the static HTML "come alive" -->

<script type="text/javascript">

Uize.require (
	[
		'UizeSite.Page.Example.library',
		'UizeSite.Page.Example',
		'Uize.Widgets.RgbSliders.Widget'
	],
	function () {
		'use strict';

		/*** create the example page widget ***/
			var page = window.page = UizeSite.Page.Example ();

		/*** set up the color picker widgets for text color, background color, and border color ***/
			function setupColorPicker (styleProperty,initialValue) {
				function syncStylePropertyToColorPicker (_event) {
					page.getNode ('sampleNode').style [styleProperty] = '#' + colorPicker;
				}
				var colorPicker = page.addChild (
					styleProperty + 'Picker',
					Uize.Widgets.RgbSliders.Widget,
					{value:initialValue,built:false}
				);
				colorPicker.wire ('Changed.value',syncStylePropertyToColorPicker);
				syncStylePropertyToColorPicker ();
			}
			setupColorPicker ('color','000000');
			setupColorPicker ('backgroundColor','cccccc');
			setupColorPicker ('borderColor','aaaaaa');

		/*** wire up the page widget ***/
			page.wireUi ();
	}
);

</script>

</body>
</html>

//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer